summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Schoenfelder <paulschoenfelder@gmail.com>2013-12-08 01:02:31 -0600
committerPaul Schoenfelder <paulschoenfelder@gmail.com>2013-12-08 01:02:31 -0600
commit325f69db0bb5086a8343feddeca333d9357be7ee (patch)
tree7c793b6d139c84d284c9470dca9f265ca1f17d98 /test
parentUpdate tests (diff)
Add commands.ex tests
Diffstat (limited to 'test')
-rw-r--r--test/commands_test.exs43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/commands_test.exs b/test/commands_test.exs
new file mode 100644
index 0000000..633e152
--- /dev/null
+++ b/test/commands_test.exs
@@ -0,0 +1,43 @@
+defmodule ExIrc.CommandsTest do
+ use ExUnit.Case
+
+ use Irc.Commands
+
+ test "Commands are formatted properly" do
+ assert [1, 'TESTCMD', 1] == ctcp! 'TESTCMD'
+ assert [1, 'TESTCMD', 1] == ctcp! "TESTCMD"
+ assert [['PASS ', 'testpass'], '\r\n'] == pass! 'testpass'
+ assert [['PASS ', 'testpass'], '\r\n'] == pass! "testpass"
+ assert [['NICK ', 'testnick'], '\r\n'] == nick! 'testnick'
+ assert [['NICK ', 'testnick'], '\r\n'] == nick! "testnick"
+ assert [['USER ', 'testuser', ' 0 * :', 'Test User'], '\r\n'] == user! 'testuser', 'Test User'
+ assert [['USER ', 'testuser', ' 0 * :', 'Test User'], '\r\n'] == user! "testuser", 'Test User'
+ assert [['USER ', 'testuser', ' 0 * :', 'Test User'], '\r\n'] == user! 'testuser', "Test User"
+ assert [['USER ', 'testuser', ' 0 * :', 'Test User'], '\r\n'] == user! "testuser", "Test User"
+ assert [['PONG ', 'testnick'], '\r\n'] == pong1! 'testnick'
+ assert [['PONG ', 'testnick'], '\r\n'] == pong1! "testnick"
+ assert [['PONG ', 'testnick', ' ', 'othernick'], '\r\n'] == pong2! 'testnick', 'othernick'
+ assert [['PONG ', 'testnick', ' ', 'othernick'], '\r\n'] == pong2! "testnick", 'othernick'
+ assert [['PONG ', 'testnick', ' ', 'othernick'], '\r\n'] == pong2! 'testnick', "othernick"
+ assert [['PONG ', 'testnick', ' ', 'othernick'], '\r\n'] == pong2! "testnick", "othernick"
+ assert [['PRIVMSG ', 'testnick', ' :', 'Test message!'], '\r\n'] == privmsg! 'testnick', 'Test message!'
+ assert [['PRIVMSG ', 'testnick', ' :', 'Test message!'], '\r\n'] == privmsg! "testnick", 'Test message!'
+ assert [['PRIVMSG ', 'testnick', ' :', 'Test message!'], '\r\n'] == privmsg! 'testnick', "Test message!"
+ assert [['PRIVMSG ', 'testnick', ' :', 'Test message!'], '\r\n'] == privmsg! "testnick", "Test message!"
+ assert [['NOTICE ', 'testnick', ' :', 'Test notice!'], '\r\n'] == notice! 'testnick', 'Test notice!'
+ assert [['NOTICE ', 'testnick', ' :', 'Test notice!'], '\r\n'] == notice! "testnick", 'Test notice!'
+ assert [['NOTICE ', 'testnick', ' :', 'Test notice!'], '\r\n'] == notice! 'testnick', "Test notice!"
+ assert [['NOTICE ', 'testnick', ' :', 'Test notice!'], '\r\n'] == notice! "testnick", "Test notice!"
+ assert [['JOIN ', 'testchan', ' ', ''], '\r\n'] == join! 'testchan'
+ assert [['JOIN ', 'testchan', ' ', ''], '\r\n'] == join! "testchan"
+ assert [['JOIN ', 'testchan', ' ', 'chanpass'], '\r\n'] == join! 'testchan', 'chanpass'
+ assert [['JOIN ', 'testchan', ' ', 'chanpass'], '\r\n'] == join! "testchan", 'chanpass'
+ assert [['JOIN ', 'testchan', ' ', 'chanpass'], '\r\n'] == join! 'testchan', "chanpass"
+ assert [['JOIN ', 'testchan', ' ', 'chanpass'], '\r\n'] == join! "testchan", "chanpass"
+ assert [['PART ', 'testchan'], '\r\n'] == part! 'testchan'
+ assert [['PART ', 'testchan'], '\r\n'] == part! "testchan"
+ assert [['QUIT :', 'Leaving'], '\r\n'] == quit!
+ assert [['QUIT :', 'Goodbye, cruel world.'], '\r\n'] == quit! 'Goodbye, cruel world.'
+ assert [['QUIT :', 'Goodbye, cruel world.'], '\r\n'] == quit! "Goodbye, cruel world."
+ end
+end \ No newline at end of file