Skip to content

Commit 350a8ce

Browse files
committed
msg-join: Clean up test suite and include descriptions
1 parent 4c8cbca commit 350a8ce

File tree

1 file changed

+59
-41
lines changed

1 file changed

+59
-41
lines changed

tests/msg-join.yaml

+59-41
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
# https://github.com/SaberUK/ircparser/tree/master/test
2020

2121
tests:
22+
# the desc string holds a description of the test, if it exists
23+
2224
# the atoms dict has the keys:
2325
# * tags: tags dict
2426
# tags with no equals sign have a value of null in this file
@@ -33,8 +35,9 @@ tests:
3335

3436
# matches is a list of messages that match
3537

36-
# simple
37-
- atoms:
38+
# simple tests
39+
- desc: Simple test with verb and params.
40+
atoms:
3841
verb: "foo"
3942
params:
4043
- "bar"
@@ -44,8 +47,26 @@ tests:
4447
- "foo bar baz asdf"
4548
- "foo bar baz :asdf"
4649

50+
# with no regular params
51+
- desc: Simple test with source and no params.
52+
atoms:
53+
source: "src"
54+
verb: "AWAY"
55+
matches:
56+
- ":src AWAY"
57+
58+
- desc: Simple test with source and empty trailing param.
59+
atoms:
60+
source: "src"
61+
verb: "AWAY"
62+
params:
63+
- ""
64+
matches:
65+
- ":src AWAY :"
66+
4767
# with source
48-
- atoms:
68+
- desc: Simple test with source.
69+
atoms:
4970
source: "coolguy"
5071
verb: "foo"
5172
params:
@@ -57,7 +78,8 @@ tests:
5778
- ":coolguy foo bar baz :asdf"
5879

5980
# with trailing param
60-
- atoms:
81+
- desc: Simple test with trailing param.
82+
atoms:
6183
verb: "foo"
6284
params:
6385
- "bar"
@@ -66,7 +88,8 @@ tests:
6688
matches:
6789
- "foo bar baz :asdf quux"
6890

69-
- atoms:
91+
- desc: Simple test with empty trailing param.
92+
atoms:
7093
verb: "foo"
7194
params:
7295
- "bar"
@@ -75,7 +98,8 @@ tests:
7598
matches:
7699
- "foo bar baz :"
77100

78-
- atoms:
101+
- desc: Simple test with trailing param containing colon.
102+
atoms:
79103
verb: "foo"
80104
params:
81105
- "bar"
@@ -85,7 +109,8 @@ tests:
85109
- "foo bar baz ::asdf"
86110

87111
# with source and trailing param
88-
- atoms:
112+
- desc: Test with source and trailing param.
113+
atoms:
89114
source: "coolguy"
90115
verb: "foo"
91116
params:
@@ -95,7 +120,8 @@ tests:
95120
matches:
96121
- ":coolguy foo bar baz :asdf quux"
97122

98-
- atoms:
123+
- desc: Test with trailing containing beginning+end whitespace.
124+
atoms:
99125
source: "coolguy"
100126
verb: "foo"
101127
params:
@@ -105,7 +131,8 @@ tests:
105131
matches:
106132
- ":coolguy foo bar baz : asdf quux "
107133

108-
- atoms:
134+
- desc: Test with trailing containing what looks like another trailing param.
135+
atoms:
109136
source: "coolguy"
110137
verb: "PRIVMSG"
111138
params:
@@ -114,7 +141,8 @@ tests:
114141
matches:
115142
- ":coolguy PRIVMSG bar :lol :) "
116143

117-
- atoms:
144+
- desc: Simple test with source and empty trailing.
145+
atoms:
118146
source: "coolguy"
119147
verb: "foo"
120148
params:
@@ -124,7 +152,8 @@ tests:
124152
matches:
125153
- ":coolguy foo bar baz :"
126154

127-
- atoms:
155+
- desc: Trailing contains only spaces.
156+
atoms:
128157
source: "coolguy"
129158
verb: "foo"
130159
params:
@@ -134,8 +163,20 @@ tests:
134163
matches:
135164
- ":coolguy foo bar baz : "
136165

166+
- desc: Param containing tab (tab is not considered SPACE for message splitting).
167+
atoms:
168+
source: "coolguy"
169+
verb: "foo"
170+
params:
171+
- "b\tar"
172+
- "baz"
173+
matches:
174+
- ":coolguy foo b\tar baz"
175+
- ":coolguy foo b\tar :baz"
176+
137177
# with tags
138-
- atoms:
178+
- desc: Tag with no value and space-filled trailing.
179+
atoms:
139180
tags:
140181
"asd": null
141182
source: "coolguy"
@@ -147,7 +188,8 @@ tests:
147188
matches:
148189
- "@asd :coolguy foo bar baz : "
149190

150-
- atoms:
191+
- desc: Tags with escaped values.
192+
atoms:
151193
verb: "foo"
152194
tags:
153195
"a": "b\\and\nk"
@@ -156,7 +198,8 @@ tests:
156198
- "@a=b\\\\and\\nk;d=gh\\:764 foo"
157199
- "@d=gh\\:764;a=b\\\\and\\nk foo"
158200

159-
- atoms:
201+
- desc: Tags with escaped values and params.
202+
atoms:
160203
verb: "foo"
161204
tags:
162205
"a": "b\\and\nk"
@@ -170,35 +213,10 @@ tests:
170213
- "@d=gh\\:764;a=b\\\\and\\nk foo par1 par2"
171214
- "@d=gh\\:764;a=b\\\\and\\nk foo par1 :par2"
172215

173-
- atoms:
216+
- desc: Tag with long, strange values (including LF and newline).
217+
atoms:
174218
tags:
175219
foo: "\\\\;\\s \r\n"
176220
verb: "COMMAND"
177221
matches:
178222
- "@foo=\\\\\\\\\\:\\\\s\\s\\r\\n COMMAND"
179-
180-
# with and without last param
181-
- atoms:
182-
source: "src"
183-
verb: "AWAY"
184-
matches:
185-
- ":src AWAY"
186-
187-
- atoms:
188-
source: "src"
189-
verb: "AWAY"
190-
params:
191-
- ""
192-
matches:
193-
- ":src AWAY :"
194-
195-
# tab is not considered <SPACE>
196-
- atoms:
197-
source: "coolguy"
198-
verb: "foo"
199-
params:
200-
- "b\tar"
201-
- "baz"
202-
matches:
203-
- ":coolguy foo b\tar baz"
204-
- ":coolguy foo b\tar :baz"

0 commit comments

Comments
 (0)