Skip to content

Commit e289fc9

Browse files
author
Antoine Pelisse
committed
Run non-required union tests last
Currently, we run each test twice when unions aren't required: once with and once without them enabled. Since we run with the union enabled first, legitimate test failures are prepended with "fails when unions are on" which is misleading since they may not be caused by unions. Running union tests last removes that mis-leading prefix and makes it clear if the problem comes from union or not.
1 parent 446b504 commit e289fc9

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

internal/fixture/state.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,6 @@ func (tc TestCase) TestWithConverter(parser typed.ParseableType, converter merge
425425
}
426426
if tc.RequiresUnions {
427427
state.Updater.EnableUnionFeature()
428-
} else {
429-
// Also test it with unions on.
430-
tc2 := tc
431-
tc2.RequiresUnions = true
432-
err := tc2.TestWithConverter(parser, converter)
433-
if err != nil {
434-
return fmt.Errorf("fails if unions are on: %v", err)
435-
}
436428
}
437429
// We currently don't have any test that converts, we can take
438430
// care of that later.
@@ -467,5 +459,15 @@ func (tc TestCase) TestWithConverter(parser typed.ParseableType, converter merge
467459
}
468460
}
469461

462+
if !tc.RequiresUnions {
463+
// Re-run the test with unions on.
464+
tc2 := tc
465+
tc2.RequiresUnions = true
466+
err := tc2.TestWithConverter(parser, converter)
467+
if err != nil {
468+
return fmt.Errorf("fails if unions are on: %v", err)
469+
}
470+
}
471+
470472
return nil
471473
}

0 commit comments

Comments
 (0)