Skip to content

Commit

Permalink
Tests: Show Panicked table test
Browse files Browse the repository at this point in the history
  • Loading branch information
earthboundkid committed Dec 7, 2024
1 parent 892111e commit d19f180
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions panic_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ func ExamplePanicked() {
// Because a panic fails a test by default,
// testing that an operation does not panic is less necessary,
// but may be helpful in a table test.
denom := 2
panicVal := be.Panicked(func() {
divide(1, denom)
})
wantPanic := denom == 0
be.Equal(t, wantPanic, panicVal != nil)
for _, denom := range []int{-1, 0, 1, 1_000} {
shouldPanic := denom == 0
panicVal := be.Panicked(func() {
divide(1, denom)
})
be.Equal(t, shouldPanic, panicVal != nil)
}

// Output:
}

0 comments on commit d19f180

Please sign in to comment.