From a90ee16a201edaacb0c6e06e9e21bb1bb2449462 Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Sun, 8 Oct 2017 09:26:01 +1000 Subject: [PATCH] caps: Test Add, Remove and String --- irc/caps/set_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/irc/caps/set_test.go b/irc/caps/set_test.go index 6cf0d1b8..290c6e7f 100644 --- a/irc/caps/set_test.go +++ b/irc/caps/set_test.go @@ -43,4 +43,28 @@ func TestSets(t *testing.T) { if s1.Count() != 2 { t.Error("Count() did not match expected capability count") } + + // make sure add and remove work fine + s1.Add(InviteNotify) + s1.Remove(EchoMessage) + + if s1.Count() != 2 { + t.Error("Count() did not match expected capability count") + } + + // test String() + values := NewValues() + values.Set(InviteNotify, "invitemepls") + + actualCap301ValuesString := s1.String(Cap301, values) + expectedCap301ValuesString := "invite-notify userhost-in-names" + if actualCap301ValuesString != expectedCap301ValuesString { + t.Errorf("Generated Cap301 values string [%s] did not match expected values string [%s]", actualCap301ValuesString, expectedCap301ValuesString) + } + + actualCap302ValuesString := s1.String(Cap302, values) + expectedCap302ValuesString := "invite-notify=invitemepls userhost-in-names" + if actualCap302ValuesString != expectedCap302ValuesString { + t.Errorf("Generated Cap302 values string [%s] did not match expected values string [%s]", actualCap302ValuesString, expectedCap302ValuesString) + } }