1
0
mirror of https://github.com/golang/go synced 2024-11-17 23:54:51 -07:00

cmd/go: convert TestRunPkg to the script framework

Part of the effort to convert all non-parallel cmd/go tests to the script
framework.

Updates #17751
Updates #36320

Change-Id: I2bc0b1e5c03e2c49b5c79ac24a908a202840d5d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/212879
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Michael Matloob 2019-12-30 14:55:57 -05:00
parent 0a61a195d7
commit cf7a46c1da
2 changed files with 14 additions and 12 deletions

View File

@ -1026,18 +1026,6 @@ func TestInternalPackagesOutsideGOROOTAreRespected(t *testing.T) {
tg.grepBoth(`testinternal2(\/|\\)p\.go\:3\:8\: use of internal package .*internal/w not allowed`, "wrote error message for testdata/testinternal2")
}
func TestRunPkg(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()
dir := filepath.Join(tg.pwd(), "testdata")
tg.setenv("GOPATH", dir)
tg.run("run", "hello")
tg.grepStderr("hello, world", "did not find hello, world")
tg.cd(filepath.Join(dir, "src/hello"))
tg.run("run", ".")
tg.grepStderr("hello, world", "did not find hello, world")
}
func TestInternalPackageErrorsAreHandled(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()

View File

@ -0,0 +1,14 @@
cd $GOPATH
go run hello
stderr 'hello, world'
cd src/hello
go run .
stderr 'hello, world'
-- hello/hello.go --
package main
func main() {
println("hello, world")
}