diff options
Diffstat (limited to 'doc/progs/run')
-rwxr-xr-x | doc/progs/run | 74 |
1 files changed, 54 insertions, 20 deletions
diff --git a/doc/progs/run b/doc/progs/run index 9d56049a8..5a2b78651 100755 --- a/doc/progs/run +++ b/doc/progs/run @@ -20,31 +20,60 @@ else $GC file.go fi +defer_panic_recover=" + defer.go + defer2.go +" + +effective_go=" + eff_bytesize.go + eff_qr.go + eff_sequence.go +" + +error_handling=" + error.go + error2.go + error3.go + error4.go +" + +go_tutorial=" + cat.go + cat_rot13.go + echo.go + helloworld.go + helloworld3.go + print.go + print_string.go + server.go + server1.go + sieve.go + sieve1.go + sort.go + sortmain.go + strings.go + sum.go +" + for i in \ - helloworld.go \ - helloworld3.go \ - echo.go \ - cat.go \ - cat_rot13.go \ - sum.go \ - sort.go \ - sortmain.go \ - print.go \ - print_string.go \ - sieve.go \ - sieve1.go \ - server1.go \ - strings.go \ - eff_bytesize.go\ - eff_qr.go \ - eff_sequence.go\ + $defer_panic_recover \ + $effective_go \ + $error_handling \ + $go_tutorial \ + slices.go \ + go1.go \ ; do $GC $i done +# Write to temporary file to avoid mingw bash bug. +TMPFILE="/tmp/gotest3.$USER" + function testit { $LD $1.$O - x=$(echo $(./$O.out $2 2>&1)) # extra echo canonicalizes + ./$O.out $2 2>&1 >"$TMPFILE" || true + x=$(echo $(cat "$TMPFILE")) # extra echo canonicalizes if [ "$x" != "$3" ] then echo $1 failed: '"'$x'"' is not '"'$3'"' @@ -53,7 +82,8 @@ function testit { function testitpipe { $LD $1.$O - x=$(echo $(./$O.out | $2 2>&1)) # extra echo canonicalizes + ./$O.out | $2 2>&1 >"$TMPFILE" || true + x=$(echo $(cat "$TMPFILE")) # extra echo canonicalizes if [ "$x" != "$3" ] then echo $1 failed: '"'$x'"' is not '"'$3'"' @@ -66,6 +96,8 @@ testit helloworld3 "" "hello, world can't open file; err=no such file or directo testit echo "hello, world" "hello, world" testit sum "" "6" testit strings "" "" +testit defer "" "0 3210 2" +testit defer2 "" "Calling g. Printing in g 0 Printing in g 1 Printing in g 2 Printing in g 3 Panicking! Defer in g 3 Defer in g 2 Defer in g 1 Defer in g 0 Recovered in f 4 Returned normally from f." alphabet=abcdefghijklmnopqrstuvwxyz rot13=nopqrstuvwxyzabcdefghijklm @@ -88,4 +120,6 @@ testit server1 "" "" testit eff_bytesize "" "1.00YB 9.09TB" testit eff_sequence "" "[-1 2 6 16 44]" -rm -f $O.out *.$O +testit go1 "" "Christmas is a holiday: true" + +rm -f $O.out $O.out.exe *.$O "$TMPFILE" |