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:
parent
0a61a195d7
commit
cf7a46c1da
@ -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()
|
||||
|
14
src/cmd/go/testdata/script/run_hello_pkg.txt
vendored
Normal file
14
src/cmd/go/testdata/script/run_hello_pkg.txt
vendored
Normal 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")
|
||||
}
|
Loading…
Reference in New Issue
Block a user