mirror of
https://github.com/ergochat/ergo.git
synced 2025-06-24 07:37:33 +02:00

* spec update: metadata keys are lowercase * add batch parameter to metadata batches * fix: connecting clients receive METADATA, not RPL_KEYVALUE * spec update: send RPL_METADATASUBS in a metadata-subs batch * move some helpers * bump irctest to forked hash This is https://github.com/progval/irctest/pull/314 but I don't want to couple the merges * fix: empty value is valid * fix: deleting a nonexistent key gets a FAIL
26 lines
565 B
Go
26 lines
565 B
Go
package irc
|
|
|
|
import "testing"
|
|
|
|
func TestKeyCheck(t *testing.T) {
|
|
cases := []struct {
|
|
input string
|
|
isEvil bool
|
|
}{
|
|
{"ImNormalButIHaveCaps", true},
|
|
{"imnormalandidonthavecaps", false},
|
|
{"ergo.chat/vendor-extension", false},
|
|
{"", true},
|
|
{":imevil", true},
|
|
{"im:evil", true},
|
|
{"key£with$not%allowed^chars", true},
|
|
{"key.thats_completely/normal-and.fine", false},
|
|
}
|
|
|
|
for _, c := range cases {
|
|
if metadataKeyIsEvil(c.input) != c.isEvil {
|
|
t.Errorf("%s should have returned %v. but it didn't. so that's not great", c.input, c.isEvil)
|
|
}
|
|
}
|
|
}
|