Skip to content

Commit d0a014b

Browse files
committed
Aim for that last bit of code coverage
1 parent aabda25 commit d0a014b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

client_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,34 @@ func TestPingLoop(t *testing.T) {
261261
lastPing = m
262262
}),
263263
})
264+
265+
// This one is just for coverage, so we know we're hitting the
266+
// branch that drops extra pings.
267+
config.PingFrequency = 5 * time.Millisecond
268+
config.PingTimeout = 50 * time.Millisecond
269+
runTest(t, config, io.EOF, []TestAction{
270+
ExpectLine("PASS :test_pass\r\n"),
271+
ExpectLine("NICK :test_nick\r\n"),
272+
ExpectLine("USER test_user 0.0.0.0 0.0.0.0 :test_name\r\n"),
273+
SendLine("001 :hello_world\r\n"),
274+
Delay(30 * time.Millisecond),
275+
LineFunc(func(m *Message) {
276+
lastPing = m
277+
}),
278+
LineFunc(func(m *Message) {
279+
lastPing = m
280+
}),
281+
LineFunc(func(m *Message) {
282+
lastPing = m
283+
}),
284+
LineFunc(func(m *Message) {
285+
lastPing = m
286+
}),
287+
LineFunc(func(m *Message) {
288+
lastPing = m
289+
}),
290+
LineFunc(func(m *Message) {
291+
lastPing = m
292+
}),
293+
})
264294
}

0 commit comments

Comments
 (0)