mirror of
https://github.com/burrowers/garble.git
synced 2025-12-24 12:58:05 +08:00
This mainly cleans up the few bits of code where we explicitly kept support for Go 1.15.x. With v0.1.0 released, we can drop support now, since the next v0.2.0 release will only support Go 1.16.x. Also updates all modules, including test ones, to 'go 1.16'. Note that the TOOLEXEC_IMPORTPATH refactor is not done here, despite all the TODOs about doing so when we drop 1.15 support. This is because that refactor needs to be done carefully and might have side effects, so it's best to keep it to a separate commit. Finally, update the deps.
69 lines
1.0 KiB
Plaintext
69 lines
1.0 KiB
Plaintext
skip # see https://github.com/burrowers/garble/issues/241
|
|
|
|
# Note that we need bar_test too.
|
|
env GOPRIVATE=test/bar,test/bar_test
|
|
|
|
# build the test binary
|
|
garble test -c
|
|
binsubstr bar.test$exe 'TestFoo' 'TestSeparateFoo'
|
|
! binsubstr bar.test$exe 'ImportedVar'
|
|
|
|
# run the tests
|
|
exec ./bar.test -test.v
|
|
stdout 'PASS.*TestFoo'
|
|
stdout 'PASS.*TestSeparateFoo'
|
|
|
|
[short] stop # no need to verify this with -short
|
|
|
|
# verify with regular cmd/go
|
|
exec go test -v
|
|
stdout 'PASS.*TestFoo'
|
|
|
|
-- go.mod --
|
|
module test/bar
|
|
|
|
go 1.16
|
|
-- bar.go --
|
|
package bar
|
|
|
|
func Foo() string { return "Foo" }
|
|
|
|
var ImportedVar = "imported var value"
|
|
-- bar_test.go --
|
|
package bar
|
|
|
|
import "testing"
|
|
|
|
func TestFoo(t *testing.T) {
|
|
t.Log(ImportedVar)
|
|
if Foo() != "Foo" {
|
|
t.FailNow()
|
|
}
|
|
}
|
|
-- bar_separate_test.go --
|
|
package bar_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"test/bar"
|
|
)
|
|
|
|
func TestSeparateFoo(t *testing.T) {
|
|
t.Log(bar.ImportedVar)
|
|
if bar.Foo() != "Foo" {
|
|
t.FailNow()
|
|
}
|
|
}
|
|
-- main_test.go --
|
|
package bar
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
os.Exit(m.Run())
|
|
}
|