diff options
author | Théophile Choutri <theophile@choutri.eu> | 2018-01-18 11:02:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-18 11:02:25 +0100 |
commit | 4562ee549c7213567585f33e75b8598940b55b86 (patch) | |
tree | 848766537cfb21cfde5b200dcbf4c27ceae8337b /test/utils_test.exs | |
parent | Merge pull request #74 from tchoutri/add-whois (diff) |
Fix namespaces and improve internal consistency
Diffstat (limited to 'test/utils_test.exs')
-rw-r--r-- | test/utils_test.exs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/test/utils_test.exs b/test/utils_test.exs index 3beb447..0370a82 100644 --- a/test/utils_test.exs +++ b/test/utils_test.exs @@ -1,12 +1,12 @@ -defmodule ExIrc.UtilsTest do +defmodule ExIRC.UtilsTest do use ExUnit.Case, async: true - use Irc.Commands + use ExIRC.Commands - alias ExIrc.Utils, as: Utils - alias ExIrc.Client.ClientState, as: ClientState + alias ExIRC.Utils, as: Utils + alias ExIRC.Client.ClientState, as: ClientState - doctest ExIrc.Utils + doctest ExIRC.Utils test "Given a local date/time as a tuple, can retrieve get the CTCP formatted time" do local_time = {{2013,12,6},{14,5,0}} # Mimics output of :calendar.local_time() @@ -15,7 +15,7 @@ defmodule ExIrc.UtilsTest do test "Can parse a CTCP command" do message = ':pschoenf NOTICE #testchan :' ++ '#{<<0o001>>}' ++ 'ACTION mind explodes!!' ++ '#{<<0o001>>}' - expected = %IrcMessage{ + expected = %ExIRC.Message{ nick: "pschoenf", cmd: "ACTION", ctcp: true, @@ -27,7 +27,7 @@ defmodule ExIrc.UtilsTest do test "Parse cloaked user" do message = ':foo!foo@unaffiliated/foo PRIVMSG #bar Hiya.' - expected = %IrcMessage{ + expected = %ExIRC.Message{ nick: "foo", cmd: "PRIVMSG", host: "unaffiliated/foo", @@ -41,7 +41,7 @@ defmodule ExIrc.UtilsTest do test "Parse uncloaked (normal) user" do message = ':foo!foo@80.21.56.43 PRIVMSG #bar Hiya.' - expected = %IrcMessage{ + expected = %ExIRC.Message{ nick: "foo", cmd: "PRIVMSG", host: "80.21.56.43", @@ -55,7 +55,7 @@ defmodule ExIrc.UtilsTest do test "Parse INVITE message" do message = ':pschoenf INVITE testuser #awesomechan' - assert %IrcMessage{ + assert %ExIRC.Message{ :nick => "pschoenf", :cmd => "INVITE", :args => ["testuser", "#awesomechan"] @@ -64,7 +64,7 @@ defmodule ExIrc.UtilsTest do test "Parse KICK message" do message = ':pschoenf KICK #testchan lameuser' - assert %IrcMessage{ + assert %ExIRC.Message{ :nick => "pschoenf", :cmd => "KICK", :args => ["#testchan", "lameuser"] @@ -83,7 +83,7 @@ defmodule ExIrc.UtilsTest do end test "Can parse full prefix in messages" do - assert %IrcMessage{ + assert %ExIRC.Message{ nick: "WiZ", user: "jto", host: "tolsun.oulu.fi", @@ -91,26 +91,26 @@ defmodule ExIrc.UtilsTest do end test "Can parse prefix with only hostname in messages" do - assert %IrcMessage{ + assert %ExIRC.Message{ nick: "WiZ", host: "tolsun.oulu.fi", } = Utils.parse(':WiZ!tolsun.oulu.fi NICK Kilroy') end test "Can parse reduced prefix in messages" do - assert %IrcMessage{ + assert %ExIRC.Message{ 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{ + assert %ExIRC.Message{ 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{ + assert %ExIRC.Message{ nick: "nick", user: "user.name", host: "irc.example.org" @@ -118,7 +118,7 @@ defmodule ExIrc.UtilsTest do end test "Can parse EXCLAMATION MARK in username in prefixes" do - assert %IrcMessage{ + assert %ExIRC.Message{ nick: "nick", user: "user!name", host: "irc.example.org" @@ -127,7 +127,7 @@ defmodule ExIrc.UtilsTest do test "parse join message" do message = ':pschoenf JOIN #elixir-lang' - assert %IrcMessage{ + assert %ExIRC.Message{ nick: "pschoenf", cmd: "JOIN", args: ["#elixir-lang"] @@ -148,7 +148,7 @@ defmodule ExIrc.UtilsTest do # a good idea when I realized that there's nothing in ExIRc that does anything # with 331 at all - they just fall on the floor, no crashes to be seen (ideally) message = ':irc.tinyspeck.com 332 jadams #elm-playground-news :' - assert %IrcMessage{ + assert %ExIRC.Message{ nick: "jadams", cmd: "331", args: ["#elm-playground-news", "No topic is set"] @@ -161,7 +161,7 @@ defmodule ExIrc.UtilsTest do 46, 49, 55, 46, 48, 46, 49, 32, 80, 82, 73, 86, 77, 83, 71, 32, 35, 98, 97, 114, 32, 58, 195, 169, 195, 161, 195, 167, 195, 173, 195, 179, 195, 182, 13, 10] - assert %IrcMessage{ + assert %ExIRC.Message{ args: ["#bar", "éáçíóö"], cmd: "PRIVMSG", ctcp: false, @@ -178,7 +178,7 @@ defmodule ExIrc.UtilsTest do 46, 49, 55, 46, 48, 46, 49, 32, 80, 82, 73, 86, 77, 83, 71, 32, 35, 98, 97, 114, 32, 58, 196, 164, 195, 169, 108, 197, 130, 195, 184, 32, 236, 176, 168, 13, 10] - assert %IrcMessage{ + assert %ExIRC.Message{ args: ["#bar", "Ĥélłø 차"], cmd: "PRIVMSG", ctcp: false, @@ -195,7 +195,7 @@ defmodule ExIrc.UtilsTest do 46, 49, 55, 46, 48, 46, 49, 32, 80, 82, 73, 86, 77, 83, 71, 32, 35, 98, 97, 114, 32, 58, 233, 233, 233, 13, 10] - assert %IrcMessage{ + assert %ExIRC.Message{ args: ["#bar", "ééé"], cmd: "PRIVMSG", ctcp: false, |