about summary refs log tree commit diff
path: root/src/testsuite
diff options
context:
space:
mode:
authorBryan Caldwell <bcaldwel@ucsd.edu>2008-05-05 16:04:48 +0200
committerFlorian Westphal <fw@strlen.de>2008-05-05 16:12:41 +0200
commit3d8eda9c860cbcbf195fe2242c67dd57fe966b3e (patch)
treecd58617f7ed181cf719e866f7a51a3d66befcf75 /src/testsuite
parent3283d275ba26c470d131ce0b6f66ee54a00bfd1c (diff)
downloadngircd-3d8eda9c860cbcbf195fe2242c67dd57fe966b3e.tar.gz
ngircd-3d8eda9c860cbcbf195fe2242c67dd57fe966b3e.zip
Allow KICK to handle comma-delimited lists (of channels, nicks).
includes test cases.

[fw@strlen.de:
	- move code around to avoid duplication
	- use const where possible
	- integrate test case]
Diffstat (limited to 'src/testsuite')
-rw-r--r--src/testsuite/Makefile.am6
-rw-r--r--src/testsuite/kick-test.e112
2 files changed, 118 insertions, 0 deletions
diff --git a/src/testsuite/Makefile.am b/src/testsuite/Makefile.am
index bc8df844..af1d980b 100644
--- a/src/testsuite/Makefile.am
+++ b/src/testsuite/Makefile.am
@@ -21,6 +21,7 @@ EXTRA_DIST = \
 	start-server.sh stop-server.sh tests.sh stress-server.sh \
 	test-loop.sh wait-tests.sh \
 	channel-test.e connect-test.e check-idle.e misc-test.e mode-test.e \
+	kick-test.e \
 	opless-channel-test.e \
 	who-test.e stress-A.e stress-B.e \
 	ngircd-test.conf
@@ -48,6 +49,10 @@ channel-test: tests.sh
 	rm -f channel-test
 	ln -s $(srcdir)/tests.sh channel-test
 
+kick-test: tests.sh
+	rm -f kick-test
+	ln -s $(srcdir)/tests.sh kick-test
+
 opless-channel-test: tests.sh
 	rm -f opless-channel-test
 	ln -s $(srcdir)/tests.sh opless-channel-test
@@ -67,6 +72,7 @@ mode-test: tests.sh
 TESTS = start-server.sh \
 	connect-test \
 	channel-test \
+	kick-test \
 	misc-test \
 	mode-test \
 	who-test \
diff --git a/src/testsuite/kick-test.e b/src/testsuite/kick-test.e
new file mode 100644
index 00000000..9412d321
--- /dev/null
+++ b/src/testsuite/kick-test.e
@@ -0,0 +1,112 @@
+spawn telnet localhost 6789
+expect {
+       timeout { exit 1 }
+       "Connected"
+}
+
+send "nick nick\r"
+send "user user . . :User\r"
+expect {
+       timeout { exit 1 }
+       "376"
+}
+
+send "kick #Channel nick\r"
+expect {
+       timeout { exit 1 }
+       "403"
+}
+
+send "join #Channel\r"
+
+send "kick #Channel nick\r"
+expect {
+       timeout { exit 1 }
+       "@* KICK #Channel nick :nick"
+}
+
+send "join #Channel\r"
+
+send "kick #Channel nick :reason\r"
+expect {
+       timeout { exit 1 }
+       "@* KICK #Channel nick :reason"
+}
+
+send "join #Channel,#Channel2\r"
+
+send "kick #Channel,#Channel2 nick\r"
+expect {
+       timeout { exit 1 }
+       "461"
+}
+
+send "kick #Channel,#Channel2,#NoExists,#NoExists nick1,nick,nick3,nick :reason\r"
+expect {
+       timeout { exit 1 }
+       "401"
+}
+expect {
+       timeout { exit 1 }
+       "@* KICK #Channel2 nick :reason"
+}
+expect {
+       timeout { exit 1 }
+       "401"
+}
+expect {
+       timeout { exit 1 }
+       "403"
+}
+
+send "kick #Channel nick2,nick,nick3\r"
+expect {
+       timeout { exit 1 }
+       "401"
+}
+expect {
+       timeout { exit 1 }
+       "@* KICK #Channel nick :nick"
+}
+expect {
+       timeout { exit 1 }
+       "401"
+}
+
+send "kick #Channel ,,\r"
+expect {
+       timeout { exit 1 }
+       "401"
+}
+expect {
+       timeout { exit 1 }
+       "401"
+}
+
+send "kick ,, ,,,\r"
+expect {
+       timeout { exit 1 }
+       "461"
+}
+
+send "kick ,, ,,\r"
+expect {
+       timeout { exit 1 }
+       "401"
+}
+expect {
+       timeout { exit 1 }
+       "401"
+}
+expect {
+       timeout { exit 1 }
+       "401"
+}
+
+send "quit\r"
+expect {
+       timeout { exit 1 }
+       "Connection closed"
+}
+
+# -eof-