Skip to content

Commit

Permalink
Fix now-flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingmutant committed Jun 11, 2023
1 parent cffcdad commit 3f13c8a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ func TestPanicTraceback(t *testing.T) {
t.Parallel()

testData := []struct {
name string
suffix string
fail func(*T) *testError
name string
suffix string
canSucceed bool
fail func(*T) *testError
}{
{
"impossible filter",
"pgregory.net/rapid.find[...]",
false,
func(t *T) *testError {
g := Bool().Filter(func(bool) bool { return false })
_, err := recoverValue(g, t)
Expand All @@ -38,6 +40,7 @@ func TestPanicTraceback(t *testing.T) {
{
"broken custom generator",
"pgregory.net/rapid.brokenGen",
false,
func(t *T) *testError {
g := Custom(brokenGen)
_, err := recoverValue(g, t)
Expand All @@ -47,6 +50,7 @@ func TestPanicTraceback(t *testing.T) {
{
"broken state machine",
"pgregory.net/rapid.(*brokenMachine).DoNothing",
true,
func(t *T) *testError {
return checkOnce(t, func(t *T) {
var sm brokenMachine
Expand All @@ -63,6 +67,9 @@ func TestPanicTraceback(t *testing.T) {

err := td.fail(nt)
if err == nil {
if td.canSucceed {
t.SkipNow()
}
t.Fatalf("test case did not fail")
}

Expand Down

0 comments on commit 3f13c8a

Please sign in to comment.