diff options
author | Přemysl Janouch <p@janouch.name> | 2018-08-06 12:09:18 +0200 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-08-06 12:09:18 +0200 |
commit | 3fee7e8051dc65438e2e633f76c807d743f1a6ea (patch) | |
tree | 5520d6886d53ec43e98619e5fb949e3bdc95cf11 /xS/main_test.go | |
parent | 09d7a10b6997c805f87b3f6fae2a8de162b16e12 (diff) | |
download | xK-3fee7e8051dc65438e2e633f76c807d743f1a6ea.tar.gz xK-3fee7e8051dc65438e2e633f76c807d743f1a6ea.tar.xz xK-3fee7e8051dc65438e2e633f76c807d743f1a6ea.zip |
hid: port IRC tests from liberty, fix tag parsing
Diffstat (limited to 'xS/main_test.go')
-rw-r--r-- | xS/main_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/xS/main_test.go b/xS/main_test.go index 90a55f6..4d6ccb3 100644 --- a/xS/main_test.go +++ b/xS/main_test.go @@ -137,3 +137,32 @@ func TestDetectTLS(t *testing.T) { } }) } + +func TestIRC(t *testing.T) { + msg := ircParseMessage( + `@first=a\:\s\r\n\\;2nd :srv hi there :good m8 :how are you?`) + + if !reflect.DeepEqual(msg.tags, map[string]string{ + "first": "a; \r\n\\", + "2nd": "", + }) { + t.Error("tags parsed incorrectly") + } + + if msg.nick != "srv" || msg.user != "" || msg.host != "" { + t.Error("server name parsed incorrectly") + } + if msg.command != "hi" { + t.Error("command name parsed incorrectly") + } + if !reflect.DeepEqual(msg.params, + []string{"there", "good m8 :how are you?"}) { + t.Error("params parsed incorrectly") + } + + if !ircEqual("[fag]^", "{FAG}~") { + t.Error("string case comparison not according to RFC 2812") + } + + // TODO: More tests. +} |