You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
garble/testdata/scripts/test.txt

67 lines
991 B
Plaintext

# 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.15
-- 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())
}