summaryrefslogtreecommitdiff
path: root/crocoite/test_irc.py
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2018-10-03 13:38:10 +0200
committerLars-Dominik Braun <lars@6xq.net>2018-10-03 13:38:10 +0200
commit1231e9066a3fcf49bcaa6499e2407ff879d14227 (patch)
tree9eed1e17dd7ba47d45c570ad3d09e3867a04a346 /crocoite/test_irc.py
parent0867960b134680205946bdc05713d07f89f47785 (diff)
downloadcrocoite-1231e9066a3fcf49bcaa6499e2407ff879d14227.tar.gz
crocoite-1231e9066a3fcf49bcaa6499e2407ff879d14227.tar.bz2
crocoite-1231e9066a3fcf49bcaa6499e2407ff879d14227.zip
irc: Fix mode parsing
Ignore unsupported modes, add tests.
Diffstat (limited to 'crocoite/test_irc.py')
-rw-r--r--crocoite/test_irc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/crocoite/test_irc.py b/crocoite/test_irc.py
new file mode 100644
index 0000000..268c604
--- /dev/null
+++ b/crocoite/test_irc.py
@@ -0,0 +1,14 @@
+import pytest
+from .irc import ArgparseBot
+
+def test_mode_parse ():
+ assert ArgparseBot.parseMode ('+a') == [('+', 'a')]
+ assert ArgparseBot.parseMode ('+ab') == [('+', 'a'), ('+', 'b')]
+ assert ArgparseBot.parseMode ('+a+b') == [('+', 'a'), ('+', 'b')]
+ assert ArgparseBot.parseMode ('-a') == [('-', 'a')]
+ assert ArgparseBot.parseMode ('-ab') == [('-', 'a'), ('-', 'b')]
+ assert ArgparseBot.parseMode ('-a-b') == [('-', 'a'), ('-', 'b')]
+ assert ArgparseBot.parseMode ('+a-b') == [('+', 'a'), ('-', 'b')]
+ assert ArgparseBot.parseMode ('-a+b') == [('-', 'a'), ('+', 'b')]
+ assert ArgparseBot.parseMode ('-ab+cd') == [('-', 'a'), ('-', 'b'), ('+', 'c'), ('+', 'd')]
+