You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
698 B
Plaintext
34 lines
698 B
Plaintext
5 years ago
|
[!exec:go] skip
|
||
|
[!symlink] skip
|
||
|
|
||
|
# We want to use the current garble, not whichever happens to be globally
|
||
|
# installed. Use the test binary with TESTSCRIPT_COMMAND, which we know will
|
||
|
# correctly run garble thanks to go-internal/testscript.
|
||
|
mkdir .bin
|
||
|
symlink .bin/garble$exe -> $TESTBIN
|
||
|
env PATH=.bin${:}$PATH
|
||
|
env TESTSCRIPT_COMMAND=garble
|
||
|
|
||
|
exec go build -toolexec=garble main.go
|
||
|
exists main
|
||
|
exec ./main
|
||
|
cmp stderr main.stderr
|
||
|
# TODO
|
||
|
# ! grep 'globalVar' main
|
||
|
# ! grep 'globalFunc' main
|
||
|
|
||
|
-- main.go --
|
||
|
package main
|
||
|
|
||
|
var globalVar = "global value"
|
||
|
|
||
|
func globalFunc() { println("global func body") }
|
||
|
|
||
|
func main() {
|
||
|
println(globalVar)
|
||
|
globalFunc()
|
||
|
}
|
||
|
-- main.stderr --
|
||
|
global value
|
||
|
global func body
|