| 1 |
env GO111MODULE=on |
| 2 |
[short] skip |
| 3 |
|
| 4 |
# Check for correct naming of temporary executable |
| 5 |
|
| 6 |
#Test for single file specified |
| 7 |
cd x/y/z |
| 8 |
go run foo.go |
| 9 |
stderr 'foo' |
| 10 |
|
| 11 |
#Test for current directory |
| 12 |
go run . |
| 13 |
stderr 'z' |
| 14 |
|
| 15 |
#Test for set path |
| 16 |
go run m/x/y/z/ |
| 17 |
stderr 'z' |
| 18 |
|
| 19 |
-- m/x/y/z/foo.go -- |
| 20 |
package main |
| 21 |
import( |
| 22 |
"os" |
| 23 |
"path/filepath" |
| 24 |
) |
| 25 |
func main() { |
| 26 |
println(filepath.Base(os.Args[0])) |
| 27 |
} |
| 28 |
|
| 29 |
-- x/y/z/foo.go -- |
| 30 |
package main |
| 31 |
import( |
| 32 |
"os" |
| 33 |
"path/filepath" |
| 34 |
) |
| 35 |
func main() { |
| 36 |
println(filepath.Base(os.Args[0])) |
| 37 |
} |
| 38 |
|
| 39 |
-- x/y/z/foo.go -- |
| 40 |
package main |
| 41 |
import( |
| 42 |
"os" |
| 43 |
"path/filepath" |
| 44 |
) |
| 45 |
func main() { |
| 46 |
println(filepath.Base(os.Args[0])) |
| 47 |
} |
| 48 |
|
| 49 |
-- go.mod -- |
| 50 |
module m |