Skip to content

Commit

Permalink
Added test for nil Metrics.Errors slice
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevin Teacutter committed May 14, 2018
1 parent 478e54b commit 5cff1c0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,17 @@ func TestMetrics_NoInfiniteRate(t *testing.T) {
t.Errorf("got rate %f, want %f", got, want)
}
}

// https://github.com/tsenart/vegeta/pull/277
func TestMetrics_NilErrorOnClose(t *testing.T) {
t.Parallel()

m := Metrics{Errors: nil}
m.Close()

got, want := m.Errors, []string{}

if !reflect.DeepEqual(got, want) {
t.Errorf("\ngot: %+v\nwant: %+v", got, want)
}
}

0 comments on commit 5cff1c0

Please sign in to comment.