Skip to content

Commit

Permalink
Aim for that last bit of code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
belak committed Aug 22, 2017
1 parent aabda25 commit d0a014b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,34 @@ func TestPingLoop(t *testing.T) {
lastPing = m
}),
})

// This one is just for coverage, so we know we're hitting the
// branch that drops extra pings.
config.PingFrequency = 5 * time.Millisecond
config.PingTimeout = 50 * time.Millisecond
runTest(t, config, io.EOF, []TestAction{
ExpectLine("PASS :test_pass\r\n"),
ExpectLine("NICK :test_nick\r\n"),
ExpectLine("USER test_user 0.0.0.0 0.0.0.0 :test_name\r\n"),
SendLine("001 :hello_world\r\n"),
Delay(30 * time.Millisecond),
LineFunc(func(m *Message) {
lastPing = m
}),
LineFunc(func(m *Message) {
lastPing = m
}),
LineFunc(func(m *Message) {
lastPing = m
}),
LineFunc(func(m *Message) {
lastPing = m
}),
LineFunc(func(m *Message) {
lastPing = m
}),
LineFunc(func(m *Message) {
lastPing = m
}),
})
}

0 comments on commit d0a014b

Please sign in to comment.