diff options
author | Nicolas Hake <nh@nosebud.de> | 2016-06-30 11:22:05 +0200 |
---|---|---|
committer | Nicolas Hake <nh@nosebud.de> | 2016-11-07 16:33:46 +0100 |
commit | 07e0c265d3e9963285e1ce5155c2abebc1fecdc8 (patch) | |
tree | 849c4e367df26d4ba44d1ba0aa0caf3a1ea25758 /test | |
parent | Add test for JOIN notification. See #56 (diff) |
Add tests for prefix handling
RFC 2812 has almost all fields in the message prefix marked optional.
Additionally, some fields may contain values that are used as separators
elsewhere.
Diffstat (limited to 'test')
-rw-r--r-- | test/utils_test.exs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/utils_test.exs b/test/utils_test.exs index 9b669c7..31dac37 100644 --- a/test/utils_test.exs +++ b/test/utils_test.exs @@ -54,6 +54,42 @@ defmodule ExIrc.UtilsTest do } = Utils.isup(parsed.args, state) end + test "Can parse full prefix in messages" do + assert %IrcMessage{ + nick: "WiZ", + user: "jto", + host: "tolsun.oulu.fi", + } = Utils.parse(':WiZ!jto@tolsun.oulu.fi NICK Kilroy') + end + + test "Can parse reduced prefix in messages" do + assert %IrcMessage{ + nick: "Trillian", + } = Utils.parse(':Trillian SQUIT cm22.eng.umd.edu :Server out of control') + end + + test "Can parse server-only prefix in messages" do + assert %IrcMessage{ + server: "ircd.stealth.net" + } = Utils.parse(':ircd.stealth.net 302 yournick :syrk=+syrk@millennium.stealth.net') + end + + test "Can parse FULL STOP in username in prefixes" do + assert %IrcMessage{ + nick: "nick", + user: "user.name", + host: "irc.example.org" + } = Utils.parse(':nick!user.name@irc.example.org PART #channel') + end + + test "Can parse EXCLAMATION MARK in username in prefixes" do + assert %IrcMessage{ + nick: "nick", + user: "user!name", + host: "irc.example.org" + } = Utils.parse(':nick!user!name@irc.example.org PART #channel') + end + test "parse join message" do message = ':pschoenf JOIN #elixir-lang' assert %IrcMessage{ |