Skip to content

Commit 636832b

Browse files
committed
Update external testcases repo
1 parent 01700c2 commit 636832b

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

parser_test.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func TestMessageCopy(t *testing.T) {
113113

114114
type MsgSplitTests struct {
115115
Tests []struct {
116+
Desc string
116117
Input string
117118
Atoms struct {
118119
Source *string
@@ -135,15 +136,15 @@ func TestMsgSplit(t *testing.T) {
135136

136137
for _, test := range splitTests.Tests {
137138
msg, err := ParseMessage(test.Input)
138-
assert.NoError(t, err, "Failed to parse: %s (%s)", test.Input, err)
139+
assert.NoError(t, err, "%s: Failed to parse: %s (%s)", test.Desc, test.Input, err)
139140

140141
assert.Equal(t,
141142
strings.ToUpper(test.Atoms.Verb), msg.Command,
142-
"Wrong command for input: %s", test.Input,
143+
"%s: Wrong command for input: %s", test.Desc, test.Input,
143144
)
144145
assert.Equal(t,
145146
test.Atoms.Params, msg.Params,
146-
"Wrong params for input: %s", test.Input,
147+
"%s: Wrong params for input: %s", test.Desc, test.Input,
147148
)
148149

149150
if test.Atoms.Source != nil {
@@ -152,23 +153,25 @@ func TestMsgSplit(t *testing.T) {
152153

153154
assert.Equal(t,
154155
len(test.Atoms.Tags), len(msg.Tags),
155-
"Wrong number of tags",
156+
"%s: Wrong number of tags",
157+
test.Desc,
156158
)
157159

158160
for k, v := range test.Atoms.Tags {
159161
tag, ok := msg.GetTag(k)
160162
assert.True(t, ok, "Missing tag")
161163
if v == nil {
162-
assert.EqualValues(t, "", tag, "Tag differs")
164+
assert.EqualValues(t, "", tag, "%s: Tag %q differs: %s != \"\"", test.Desc, k, tag)
163165
} else {
164-
assert.EqualValues(t, v, tag, "Tag differs")
166+
assert.EqualValues(t, v, tag, "%s: Tag %q differs: %s != %s", test.Desc, k, v, tag)
165167
}
166168
}
167169
}
168170
}
169171

170172
type MsgJoinTests struct {
171173
Tests []struct {
174+
Desc string
172175
Atoms struct {
173176
Source string
174177
Verb string
@@ -211,6 +214,7 @@ func TestMsgJoin(t *testing.T) {
211214

212215
type UserhostSplitTests struct {
213216
Tests []struct {
217+
Desc string
214218
Source string
215219
Atoms struct {
216220
Nick string
@@ -235,15 +239,15 @@ func TestUserhostSplit(t *testing.T) {
235239

236240
assert.Equal(t,
237241
test.Atoms.Nick, prefix.Name,
238-
"Name did not match for input: %q", test.Source,
242+
"%s: Name did not match for input: %q", test.Desc, test.Source,
239243
)
240244
assert.Equal(t,
241245
test.Atoms.User, prefix.User,
242-
"User did not match for input: %q", test.Source,
246+
"%s: User did not match for input: %q", test.Desc, test.Source,
243247
)
244248
assert.Equal(t,
245249
test.Atoms.Host, prefix.Host,
246-
"Host did not match for input: %q", test.Source,
250+
"%s: Host did not match for input: %q", test.Desc, test.Source,
247251
)
248252
}
249253
}

testcases

0 commit comments

Comments
 (0)