| # This is a script test conversion of TestPackageMainTestCompilerFlags |
| # originally added in CL 86265, which fixed #23180. |
| # Test that we don't pass the package name 'main' to -p when building the |
| # test package for a main package. |
| |
| go test -c -n p1 |
| # should not have run compile -p main p1.go |
| ! stdout '([\\/]compile|gccgo).* (-p main|-fgo-pkgpath=main).*p1\.go' |
| ! stderr '([\\/]compile|gccgo).* (-p main|-fgo-pkgpath=main).*p1\.go' |
| # should have run compile -p p1 p1.go |
| stderr '([\\/]compile|gccgo).* (-p p1|-fgo-pkgpath=p1).*p1\.go' |
| |
| -- go.mod -- |
| module p1 |
| -- p1.go -- |
| package main |
| -- p1_test.go -- |
| package main |
| |
| import "testing" |
| |
| func Test(t *testing.T){} |