mirror of
https://github.com/jeremyd/ergo.git
synced 2026-05-01 18:09:58 -07:00
don't send multiline responses to CAP LS 301 (#2068)
* don't send multiline responses to CAP LS 301 This is more or less explicitly prohibited by the spec: https://ircv3.net/specs/extensions/capability-negotiation.html#multiline-replies-to-cap-ls-and-cap-list * switch to whitelist model to be future-proof * bump irctest to include test * add a unit test
This commit is contained in:
committed by
GitHub
parent
3e68694760
commit
d082ec7ab9
@@ -3,8 +3,11 @@
|
||||
|
||||
package caps
|
||||
|
||||
import "testing"
|
||||
import "reflect"
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSets(t *testing.T) {
|
||||
s1 := NewSet()
|
||||
@@ -60,6 +63,19 @@ func TestSets(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func assertEqual(found, expected interface{}) {
|
||||
if !reflect.DeepEqual(found, expected) {
|
||||
panic(fmt.Sprintf("found %#v, expected %#v", found, expected))
|
||||
}
|
||||
}
|
||||
|
||||
func Test301WhitelistNotRespectedFor302(t *testing.T) {
|
||||
s1 := NewSet()
|
||||
s1.Enable(AccountTag, EchoMessage, StandardReplies)
|
||||
assertEqual(s1.Strings(Cap301, nil, 0), []string{"account-tag echo-message"})
|
||||
assertEqual(s1.Strings(Cap302, nil, 0), []string{"account-tag echo-message standard-replies"})
|
||||
}
|
||||
|
||||
func TestSubtract(t *testing.T) {
|
||||
s1 := NewSet(AccountTag, EchoMessage, UserhostInNames, ServerTime)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user