summaryrefslogtreecommitdiff
path: root/test/parser/isupport_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/parser/isupport_test.exs')
-rw-r--r--test/parser/isupport_test.exs36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/parser/isupport_test.exs b/test/parser/isupport_test.exs
new file mode 100644
index 0000000..e8185b7
--- /dev/null
+++ b/test/parser/isupport_test.exs
@@ -0,0 +1,36 @@
+defmodule Irc.Parser.IsupportTest do
+ use ExUnit.Case
+ alias Irc.Parser.Isupport
+ doctest Irc.Parser.Isupport
+
+ test "flag" do
+ assert Isupport.parse(["WHOX"]) == %{"WHOX" => true}
+ end
+
+ test "k-v" do
+ assert Isupport.parse(["HELLO=WORLD"]) == %{"HELLO" => "WORLD"}
+ end
+
+ test "k-v, integer value" do
+ assert Isupport.parse(["RESPONSE=42"]) == %{"RESPONSE" => 42}
+ end
+
+ test "key with multiple values" do
+ assert Isupport.parse(["TARGMAX=NAMES:1,MONITOR:,NOTICE:4"]) == %{
+ "TARGMAX" => %{
+ "NAMES" => 1,
+ "MONITOR" => "",
+ "NOTICE" => 4
+ }
+ }
+ end
+
+ test "PREFIX" do
+ assert Isupport.parse(["PREFIX=(ovh)@+%"]) == %{
+ "PREFIX" => %{
+ "%" => "h", "+" => "v", "@" => "o"
+ }
+ }
+ end
+
+end