diff options
Diffstat (limited to 'test/parser/line_parser.exs')
-rw-r--r-- | test/parser/line_parser.exs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/parser/line_parser.exs b/test/parser/line_parser.exs new file mode 100644 index 0000000..efa0194 --- /dev/null +++ b/test/parser/line_parser.exs @@ -0,0 +1,45 @@ +defmodule Irc.Parser.LineTest do + use ExUnit.Case + alias Irc.Parser.Line + doctest Irc.Parser.Line + + test "isupport" do + line = ':nowhere 005 hrhrhr TOPICLEN=390 TARGMAX=NAMES:1,MONITOR: EXTBAN=$,acjorsxz CLIENTVER=3.0 :are supported by this server' + |> Line.parse() + assert line.source == "nowhere" + assert line.command == "005" + assert line.args == ["hrhrhr", "TOPICLEN=390", "TARGMAX=NAMES:1,MONITOR:", "EXTBAN=$,acjorsxz", "CLIENTVER=3.0", "are supported by this server"] + end + + test "auth notice" do + line = ':zoidberg.chatspike.net NOTICE Auth :Welcome to ChatSpike!' + |> Line.parse() + assert line.source == "zoidberg.chatspike.net" + assert line.command =="NOTICE" + assert line.args == ["Auth", "Welcome to ChatSpike!"] + end + + test "connect notice" do + line = ':livingstone.freenode.net NOTICE * :*** Checking Ident' + |> Line.parse() + assert line.command == "NOTICE" + assert line.source == "livingstone.freenode.net" + assert line.args == ["*", "*** Checking Ident"] + end + + test "numeric" do + line = ':stitch.chatspike.net 042 derp ABCDEFGHI :your unique ID' + |> Line.parse + assert line.source == "stitch.chatspike.net" + assert line.command == "042" + assert line.args == ["derp", "ABCDEFGHI", "your unique ID"] + end + + test "ping" do + line = 'PING :bender.chatspike.net' + |> Line.parse + assert line.command == "PING" + assert line.args == ["bender.chatspike.net"] + end + +end |