source: tags/init/test/test-parse-message.lisp

Last change on this file was 2, checked in by Erik Enge, 21 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1;;;; $Id: test-parse-message.lisp 2 2004-01-05 14:13:03Z eenge $
2;;;; $Source$
3
4;;;; See the LICENSE file for licensing information.
5
6(in-package :net-nittin-irc-test)
7
8(defvar *msg1* (format nil ":kire!~~eenge@216.248.178.227 PRIVMSG cl-irc :heyhey!~A" #\Return))
9(defvar *msg2* (format nil ":tolkien.freenode.net 372 cl-irc :-~A" #\Return))
10(defvar *msg3* (format nil "NOTICE AUTH :*** Your forward and reverse DNS don't match~A" #\Return))
11(defvar *msg4* (format nil ":kire_!~~eenge@adsl-156-35-240.asm.bellsouth.net MODE #lisppaste +k key~A" #\Return))
12(defvar *msg5* (format nil ":kire_!~~eenge@adsl-156-35-240.asm.bellsouth.net MODE #lisppaste +bbb *!*@somewhere.com *!*@somewhereles.com *!*@youdontwannaknow.org~A" #\Return))
13
14(deftest find-reply-name.1 (irc:find-reply-name 1) :rpl_welcome)
15(deftest find-reply-name.2
16    (handler-bind ((irc:no-such-reply #'continue))
17      (irc:find-reply-name 999)) :unknown-reply)
18
19(deftest return-source.1 (irc::return-source cl-irc-test::*msg1*)  5 "kire")
20(deftest return-source.2 (irc::return-source cl-irc-test::*msg2*) 21 "tolkien.freenode.net")
21(deftest return-source.3 (irc::return-source cl-irc-test::*msg3*) 0 nil)
22(deftest return-source.4 (irc::return-source cl-irc-test::*msg4*) 6 "kire_")
23(deftest return-source.5 (irc::return-source cl-irc-test::*msg5*) 6 "kire_")
24
25(deftest return-user.1 (irc::return-user cl-irc-test::*msg1* :start 5) 12 "~eenge")
26(deftest return-user.2 (irc::return-user cl-irc-test::*msg2* :start 21) 21 nil)
27(deftest return-user.3 (irc::return-user cl-irc-test::*msg3* :start 0) 0 nil)
28(deftest return-user.4 (irc::return-user cl-irc-test::*msg4* :start 6) 13 "~eenge")
29(deftest return-user.5 (irc::return-user cl-irc-test::*msg5* :start 6) 13 "~eenge")
30
31(deftest return-host.1 (irc::return-host cl-irc-test::*msg1* :start 12) 28 "216.248.178.227")
32(deftest return-host.2 (irc::return-host cl-irc-test::*msg2* :start 21) 21 nil)
33(deftest return-host.3 (irc::return-host cl-irc-test::*msg3* :start 0) 0 nil)
34(deftest return-host.4 (irc::return-host cl-irc-test::*msg4* :start 13) 47 "adsl-156-35-240.asm.bellsouth.net")
35(deftest return-host.5 (irc::return-host cl-irc-test::*msg5* :start 13) 47 "adsl-156-35-240.asm.bellsouth.net")
36
37(deftest return-command.1 (irc::return-command cl-irc-test::*msg1* :start 28) 36 "PRIVMSG")
38(deftest return-command.2 (irc::return-command cl-irc-test::*msg2* :start 21) 25 "372")
39(deftest return-command.3 (irc::return-command cl-irc-test::*msg3* :start 0) 6 "NOTICE")
40(deftest return-command.4 (irc::return-command cl-irc-test::*msg4* :start 47) 52 "MODE")
41(deftest return-command.5 (irc::return-command cl-irc-test::*msg5* :start 47) 52 "MODE")
42
43(deftest return-arguments.1 (irc::return-arguments cl-irc-test::*msg1* :start 36) 44 ("cl-irc"))
44(deftest return-arguments.2 (irc::return-arguments cl-irc-test::*msg2* :start 25) 33 ("cl-irc"))
45(deftest return-arguments.3 (irc::return-arguments cl-irc-test::*msg3* :start 6) 12 ("AUTH"))
46(deftest return-arguments.4 (irc::return-arguments cl-irc-test::*msg4* :start 52) 70 ("#lisppaste" "+k" "key"))
47(deftest return-arguments.5 (irc::return-arguments cl-irc-test::*msg5* :start 52) 132 ("#lisppaste" "+bbb" "*!*@somewhere.com" "*!*@somewhereles.com" "*!*@youdontwannaknow.org"))
48
49(deftest return-trailing-argument.1
50    (irc::return-trailing-argument cl-irc-test::*msg1* :start 44) 52 "heyhey!")
51(deftest return-trailing-argument.2
52    (irc::return-trailing-argument cl-irc-test::*msg2* :start 33) 35 "-")
53(deftest return-trailing-argument.3
54    (irc::return-trailing-argument cl-irc-test::*msg3* :start 12) 57 "*** Your forward and reverse DNS don't match")
55(deftest return-trailing-argument.4
56    (irc::return-trailing-argument cl-irc-test::*msg4* :start 70) 70 nil)
57(deftest return-trailing-argument.5
58    (irc::return-trailing-argument cl-irc-test::*msg5* :start 132) 132 nil)
59
60(deftest parse-raw-message.1
61    (irc::parse-raw-message cl-irc-test::*msg1*)
62  "kire" "~eenge" "216.248.178.227" "PRIVMSG" ("cl-irc") "heyhey!")
Note: See TracBrowser for help on using the repository browser.