diff --git a/decode_go116.go b/decode_go116.go index 38aa75fd..eddfb641 100644 --- a/decode_go116.go +++ b/decode_go116.go @@ -1,3 +1,4 @@ +//go:build go1.16 // +build go1.16 package toml diff --git a/decode_go116_test.go b/decode_go116_test.go index 5d36789b..83722f2b 100644 --- a/decode_go116_test.go +++ b/decode_go116_test.go @@ -1,3 +1,4 @@ +//go:build go1.16 // +build go1.16 package toml diff --git a/fuzz_test.go b/fuzz_test.go index e37b30f4..d57fbc3c 100644 --- a/fuzz_test.go +++ b/fuzz_test.go @@ -1,4 +1,5 @@ -// +build gofuzzbeta +//go:build go1.18 +// +build go1.18 package toml diff --git a/internal/toml-test/json.go b/internal/toml-test/json.go index bb46425c..6a3da95b 100644 --- a/internal/toml-test/json.go +++ b/internal/toml-test/json.go @@ -1,3 +1,4 @@ +//go:build go1.16 // +build go1.16 package tomltest diff --git a/internal/toml-test/runner.go b/internal/toml-test/runner.go index d3044a5c..e849f6ec 100644 --- a/internal/toml-test/runner.go +++ b/internal/toml-test/runner.go @@ -1,3 +1,4 @@ +//go:build go1.16 // +build go1.16 //go:generate ./gen-multi.py diff --git a/internal/toml-test/toml.go b/internal/toml-test/toml.go index 78e8de2b..b0351799 100644 --- a/internal/toml-test/toml.go +++ b/internal/toml-test/toml.go @@ -1,3 +1,4 @@ +//go:build go1.16 // +build go1.16 package tomltest diff --git a/toml_test.go b/toml_test.go index 85b378ca..84f6403a 100644 --- a/toml_test.go +++ b/toml_test.go @@ -1,3 +1,4 @@ +//go:build go1.16 // +build go1.16 package toml_test @@ -6,6 +7,7 @@ import ( "bytes" "encoding/json" "fmt" + "os" "path/filepath" "strings" "testing" @@ -42,11 +44,28 @@ func TestToml(t *testing.T) { } } + // TODO: bit of a hack to make sure not all test run; without this "-run=.." + // will still run alll tests, but just report the errors for the -run value. + // This is annoying in cases where you have some debug printf. + // + // Need to update toml-test a bit to make this easier, but this good enough + // for now. + var runTests []string + for _, a := range os.Args { + if strings.HasPrefix(a, "-test.run=TestToml/") { + a = strings.TrimPrefix(a, "-test.run=TestToml/encode/") + a = strings.TrimPrefix(a, "-test.run=TestToml/decode/") + runTests = []string{a, a + "/*"} + break + } + } + run := func(t *testing.T, enc bool) { r := tomltest.Runner{ - Files: tomltest.EmbeddedTests(), - Encoder: enc, - Parser: parser{}, + Files: tomltest.EmbeddedTests(), + Encoder: enc, + Parser: parser{}, + RunTests: runTests, SkipTests: []string{ // This one is annoying to fix, and such an obscure edge case // it's okay to leave it like this for now.