mirror of
https://github.com/golang/go
synced 2024-11-14 07:20:22 -07:00
7201b0c27c
Instead we'll point people at the Tour and beef up code.html. Fixes #3107. R=golang-dev, bradfitz, r, adg CC=golang-dev https://golang.org/cl/5697077
68 lines
1.3 KiB
Bash
Executable File
68 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style
|
|
# license that can be found in the LICENSE file.
|
|
|
|
set -e
|
|
|
|
eval $(gomake --no-print-directory -f ../../src/Make.inc go-env)
|
|
|
|
if [ -z "$O" ]; then
|
|
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
rm -f *.$O
|
|
|
|
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
|
|
"
|
|
|
|
for i in \
|
|
$defer_panic_recover \
|
|
$effective_go \
|
|
$error_handling \
|
|
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
|
|
./$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'"'
|
|
fi
|
|
}
|
|
|
|
|
|
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."
|
|
|
|
testit eff_bytesize "" "1.00YB 9.09TB"
|
|
testit eff_sequence "" "[-1 2 6 16 44]"
|
|
|
|
testit go1 "" "Christmas is a holiday: true"
|
|
|
|
rm -f $O.out $O.out.exe *.$O "$TMPFILE"
|