...
1# This is a script test conversion of TestPackageMainTestCompilerFlags
2# originally added in CL 86265, which fixed #23180.
3# Test that we don't pass the package name 'main' to -p when building the
4# test package for a main package.
5
6go test -c -n p1
7# should not have run compile -p main p1.go
8! stdout '([\\/]compile|gccgo).* (-p main|-fgo-pkgpath=main).*p1\.go'
9! stderr '([\\/]compile|gccgo).* (-p main|-fgo-pkgpath=main).*p1\.go'
10# should have run compile -p p1 p1.go
11stderr '([\\/]compile|gccgo).* (-p p1|-fgo-pkgpath=p1).*p1\.go'
12
13-- go.mod --
14module p1
15-- p1.go --
16package main
17-- p1_test.go --
18package main
19
20import "testing"
21
22func Test(t *testing.T){}
View as plain text