fatalf("%s is a directory, should be a Go file", file)
}
dir1, _ := filepath.Split(file)
+ if dir1 == "" {
+ dir1 = "."
+ }
if dir == "" {
dir = dir1
} else if dir != dir1 {
tg.runFail("get", "code.google.com/p/rsc-svn")
tg.grepStderr("is shutting down", "missed warning about code.google.com")
}
+
+func TestGoRunDirs(t *testing.T) {
+ tg := testgo(t)
+ defer tg.cleanup()
+ tg.cd("testdata/rundir")
+ tg.runFail("run", "x.go", "sub/sub.go")
+ tg.grepStderr("named files must all be in one directory; have . and sub/", "wrong output")
+ tg.runFail("run", "sub/sub.go", "x.go")
+ tg.grepStderr("named files must all be in one directory; have sub/ and .", "wrong output")
+}