1# ngIRCd test suite
2# Misc test
3
4spawn telnet 127.0.0.1 6789
5expect {
6	timeout { exit 1 }
7	"Connected"
8}
9
10send "nick nick\r"
11send "user user . . :User\r"
12expect {
13	timeout { exit 1 }
14	"376"
15}
16
17# RFC 2812 Section 3.4.1
18
19send "motd\r"
20expect {
21	timeout { exit 1 }
22	"375"
23}
24expect {
25	timeout { exit 1 }
26	"372"
27}
28expect {
29	timeout { exit 1 }
30	"376"
31}
32
33send "motd ngircd.test.server\r"
34expect {
35	timeout { exit 1 }
36	"375"
37}
38expect {
39	timeout { exit 1 }
40	"372"
41}
42expect {
43	timeout { exit 1 }
44	"376"
45}
46
47send "motd doesnotexist\r"
48expect {
49	timeout { exit 1 }
50	"402"
51# note this is not specified in RFC 2812, but probably should be
52}
53
54# RFC 2812 Section 3.4.3
55
56send "version\r"
57expect {
58	timeout { exit 1 }
59	"351"
60}
61
62send "version ngircd.test.server\r"
63expect {
64	timeout { exit 1 }
65	"351"
66}
67
68send "version doesnotexist\r"
69expect {
70	timeout { exit 1 }
71	"402"
72}
73
74# RFC 2812 Section 3.4.6
75
76send "time\r"
77expect {
78	timeout { exit 1 }
79	"391"
80}
81
82send "time ngircd.test.server\r"
83expect {
84	timeout { exit 1 }
85	"391"
86}
87
88send "time doesnotexist\r"
89expect {
90	timeout { exit 1 }
91	"402"
92}
93
94# RFC 2812 Section 3.4.10
95
96send "info\r"
97expect {
98	timeout { exit 1 }
99	"371"
100}
101expect {
102	timeout { exit 1 }
103	"374"
104}
105
106# RFC 2812 Section 4.5
107
108send "summon\r"
109expect {
110	timeout { exit 1 }
111	"445"
112}
113
114# RFC 2812 Section 4.6
115
116send "users\r"
117expect {
118	timeout { exit 1 }
119	"446"
120}
121
122# RFC 2812 Section 4.8
123
124send "userhost\r"
125expect {
126	timeout { exit 1 }
127	"461"
128}
129
130send "userhost nick\r"
131expect {
132	timeout { exit 1 }
133	-re ":ngircd.test.server 302 nick :?nick=+.*@127.0.0.1"
134}
135
136send "userhost doesnotexist\r"
137expect {
138	timeout { exit 1 }
139	":ngircd.test.server 302 nick :\r"
140}
141
142send "userhost nick doesnotexist nick doesnotexist\r"
143expect {
144	timeout { exit 1 }
145	-re ":ngircd.test.server 302 nick :nick=+.*@127.0.0.1 nick=+.*@127.0.0.1"
146}
147
148send "away :testing\r"
149expect {
150	timeout { exit 1 }
151	"306 nick"
152}
153
154send "userhost nick nick nick nick nick nick\r"
155expect {
156	timeout { exit 1 }
157	-re ":ngircd.test.server 302 nick :nick=-.*@127.0.0.1 nick=-.*@127.0.0.1 nick=-.*@127.0.0.1 nick=-.*@127.0.0.1 nick=-.*@127.0.0.1\r"
158}
159
160send "quit\r"
161expect {
162	timeout { exit 1 }
163	"ERROR"
164}
165