diff --git a/tester/fixture_go1.14_test.go b/tester/fixture_go1.14_test.go new file mode 100644 index 0000000000..24a558df02 --- /dev/null +++ b/tester/fixture_go1.14_test.go @@ -0,0 +1,59 @@ +// +build !go1.16 + +// The outputs here change with Go 1.16, see +// https://github.com/golang/go/commit/afe7c8d0b25f26f0abd749ca52c7e1e7dfdee8cb +// But since we've been using 1.14 by the time these split-off fixtures +// were introduced, the filename mentions go1.14. + +package tester + +const fixtureReporterVerboseBenchmark = `FAILURES +-------------------------------------------------------------------------------- +data.foo.bar.test_corge: FAIL (0s) + + +SUMMARY +-------------------------------------------------------------------------------- +data.foo.bar.test_baz 1000 123 ns/op +data.foo.bar.test_qux: ERROR (0s) + some err +data.foo.bar.test_corge: FAIL (0s) +-------------------------------------------------------------------------------- +PASS: 1/3 +FAIL: 1/3 +ERROR: 1/3 +` + +const fixtureReporterVerboseBenchmarkShowAllocations = `FAILURES +-------------------------------------------------------------------------------- +data.foo.bar.test_corge: FAIL (0s) + + +SUMMARY +-------------------------------------------------------------------------------- +data.foo.bar.test_baz 1000 123 ns/op 123 timer_rego_query_eval_ns/op 91 B/op 0 allocs/op +data.foo.bar.test_qux: ERROR (0s) + some err +data.foo.bar.test_corge: FAIL (0s) +-------------------------------------------------------------------------------- +PASS: 1/3 +FAIL: 1/3 +ERROR: 1/3 +` + +const fixtureReporterVerboseBenchmarkShowAllocationsGoBenchFormat = `FAILURES +-------------------------------------------------------------------------------- +data.foo.bar.test_corge: FAIL (0s) + + +SUMMARY +-------------------------------------------------------------------------------- +BenchmarkDataFooBarTestBaz 1000 123 ns/op 123 timer_rego_query_eval_ns/op 91 B/op 0 allocs/op +data.foo.bar.test_qux: ERROR (0s) + some err +data.foo.bar.test_corge: FAIL (0s) +-------------------------------------------------------------------------------- +PASS: 1/3 +FAIL: 1/3 +ERROR: 1/3 +` diff --git a/tester/fixture_go1.16_test.go b/tester/fixture_go1.16_test.go new file mode 100644 index 0000000000..2937cb0bce --- /dev/null +++ b/tester/fixture_go1.16_test.go @@ -0,0 +1,57 @@ +// +build go1.16 + +// See https://golang.org/cmd/go/#hdr-Build_constraints, +// this build constraint will match go 1.16 onwards. + +package tester + +const fixtureReporterVerboseBenchmark = `FAILURES +-------------------------------------------------------------------------------- +data.foo.bar.test_corge: FAIL (0s) + + +SUMMARY +-------------------------------------------------------------------------------- +data.foo.bar.test_baz 1000 123.0 ns/op +data.foo.bar.test_qux: ERROR (0s) + some err +data.foo.bar.test_corge: FAIL (0s) +-------------------------------------------------------------------------------- +PASS: 1/3 +FAIL: 1/3 +ERROR: 1/3 +` + +const fixtureReporterVerboseBenchmarkShowAllocations = `FAILURES +-------------------------------------------------------------------------------- +data.foo.bar.test_corge: FAIL (0s) + + +SUMMARY +-------------------------------------------------------------------------------- +data.foo.bar.test_baz 1000 123.0 ns/op 123.0 timer_rego_query_eval_ns/op 91 B/op 0 allocs/op +data.foo.bar.test_qux: ERROR (0s) + some err +data.foo.bar.test_corge: FAIL (0s) +-------------------------------------------------------------------------------- +PASS: 1/3 +FAIL: 1/3 +ERROR: 1/3 +` + +const fixtureReporterVerboseBenchmarkShowAllocationsGoBenchFormat = `FAILURES +-------------------------------------------------------------------------------- +data.foo.bar.test_corge: FAIL (0s) + + +SUMMARY +-------------------------------------------------------------------------------- +BenchmarkDataFooBarTestBaz 1000 123.0 ns/op 123.0 timer_rego_query_eval_ns/op 91 B/op 0 allocs/op +data.foo.bar.test_qux: ERROR (0s) + some err +data.foo.bar.test_corge: FAIL (0s) +-------------------------------------------------------------------------------- +PASS: 1/3 +FAIL: 1/3 +ERROR: 1/3 +` diff --git a/tester/reporter_test.go b/tester/reporter_test.go index b45508c98e..4a5dcc7329 100644 --- a/tester/reporter_test.go +++ b/tester/reporter_test.go @@ -359,23 +359,7 @@ func TestPrettyReporterVerboseBenchmark(t *testing.T) { t.Fatal(err) } - exp := `FAILURES --------------------------------------------------------------------------------- -data.foo.bar.test_corge: FAIL (0s) - - -SUMMARY --------------------------------------------------------------------------------- -data.foo.bar.test_baz 1000 123 ns/op -data.foo.bar.test_qux: ERROR (0s) - some err -data.foo.bar.test_corge: FAIL (0s) --------------------------------------------------------------------------------- -PASS: 1/3 -FAIL: 1/3 -ERROR: 1/3 -` - + exp := fixtureReporterVerboseBenchmark if exp != buf.String() { t.Fatalf("Expected:\n\n%v\n\nGot:\n\n%v", exp, buf.String()) } @@ -436,23 +420,7 @@ func TestPrettyReporterVerboseBenchmarkShowAllocations(t *testing.T) { t.Fatal(err) } - exp := `FAILURES --------------------------------------------------------------------------------- -data.foo.bar.test_corge: FAIL (0s) - - -SUMMARY --------------------------------------------------------------------------------- -data.foo.bar.test_baz 1000 123 ns/op 123 timer_rego_query_eval_ns/op 91 B/op 0 allocs/op -data.foo.bar.test_qux: ERROR (0s) - some err -data.foo.bar.test_corge: FAIL (0s) --------------------------------------------------------------------------------- -PASS: 1/3 -FAIL: 1/3 -ERROR: 1/3 -` - + exp := fixtureReporterVerboseBenchmarkShowAllocations if exp != buf.String() { t.Fatalf("Expected:\n\n%v\n\nGot:\n\n%v", exp, buf.String()) } @@ -514,23 +482,7 @@ func TestPrettyReporterVerboseBenchmarkShowAllocationsGoBenchFormat(t *testing.T t.Fatal(err) } - exp := `FAILURES --------------------------------------------------------------------------------- -data.foo.bar.test_corge: FAIL (0s) - - -SUMMARY --------------------------------------------------------------------------------- -BenchmarkDataFooBarTestBaz 1000 123 ns/op 123 timer_rego_query_eval_ns/op 91 B/op 0 allocs/op -data.foo.bar.test_qux: ERROR (0s) - some err -data.foo.bar.test_corge: FAIL (0s) --------------------------------------------------------------------------------- -PASS: 1/3 -FAIL: 1/3 -ERROR: 1/3 -` - + exp := fixtureReporterVerboseBenchmarkShowAllocationsGoBenchFormat if exp != buf.String() { t.Fatalf("Expected:\n\n%v\n\nGot:\n\n%v", exp, buf.String()) }