From 5d87f6ba8030eec2994aa2f53ed5c462ba4894db Mon Sep 17 00:00:00 2001 From: Brandon Beresini Date: Wed, 14 May 2008 23:39:05 -0700 Subject: [PATCH] Add tests for MOTD, VERSION, TIME, USERHOST The misc-test.e file is also somewhat reorganized and commented here. Patch from Brandon Beresini, Bryan Caldwell and Dana Dahlstrom. --- src/testsuite/misc-test.e | 129 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 125 insertions(+), 4 deletions(-) diff --git a/src/testsuite/misc-test.e b/src/testsuite/misc-test.e index 4b883798..f9142df2 100644 --- a/src/testsuite/misc-test.e +++ b/src/testsuite/misc-test.e @@ -13,17 +13,84 @@ expect { "376" } -send "summon\r" +# RFC 2812 Section 3.4.1 + +send "motd\r" expect { timeout { exit 1 } - "445" + "375" +} +expect { + timeout { exit 1 } + "372" +} +expect { + timeout { exit 1 } + "376" } -send "users\r" +send "motd ngircd.test.server\r" expect { timeout { exit 1 } - "446" + "375" } +expect { + timeout { exit 1 } + "372" +} +expect { + timeout { exit 1 } + "376" +} + +send "motd doesnotexist\r" +expect { + timeout { exit 1 } + "402" +# note this is not specified in RFC 2812, but probably should be +} + +# RFC 2812 Section 3.4.3 + +send "version\r" +expect { + timeout { exit 1 } + "351" +} + +send "version ngircd.test.server\r" +expect { + timeout { exit 1 } + "351" +} + +send "version doesnotexist\r" +expect { + timeout { exit 1 } + "402" +} + +# RFC 2812 Section 3.4.6 + +send "time\r" +expect { + timeout { exit 1 } + "391" +} + +send "time ngircd.test.server\r" +expect { + timeout { exit 1 } + "391" +} + +send "time doesnotexist\r" +expect { + timeout { exit 1 } + "402" +} + +# RFC 2812 Section 3.4.10 send "info\r" expect { @@ -35,6 +102,60 @@ expect { "374" } +# RFC 2812 Section 4.5 + +send "summon\r" +expect { + timeout { exit 1 } + "445" +} + +# RFC 2812 Section 4.6 + +send "users\r" +expect { + timeout { exit 1 } + "446" +} + +# RFC 2812 Section 4.8 + +send "userhost\r" +expect { + timeout { exit 1 } + "461" +} + +send "userhost nick\r" +expect { + timeout { exit 1 } + -re ":ngircd.test.server 302 nick :?nick=+.*@(localhost|127.0.0.1)" +} + +send "userhost doesnotexist\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 302 nick :\r" +} + +send "userhost nick doesnotexist nick doesnotexist\r" +expect { + timeout { exit 1 } + -re ":ngircd.test.server 302 nick :nick=+.*@(localhost|127.0.0.1) nick=+.*@(localhost|127.0.0.1)" +} + +send "away :testing\r" +expect { + timeout { exit 1 } + "306 nick" +} + +send "userhost nick nick nick nick nick nick\r" +expect { + timeout { exit 1 } + -re ":ngircd.test.server 302 nick :nick=-.*@(localhost|127.0.0.1) nick=-.*@(localhost|127.0.0.1) nick=-.*@(localhost|127.0.0.1) nick=-.*@(localhost|127.0.0.1) nick=-.*@(localhost|127.0.0.1)\r" +} + send "quit\r" expect { timeout { exit 1 }