diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
commit | 519725bb3c075ee2462c929f5997cb068e18466a (patch) | |
tree | 5b162e8488ad147a645048c073577821b4a2bee9 /src/cmd/go/test.bash | |
parent | 842623c5dd2819d980ca9c58048d6bc6ed82475f (diff) | |
download | golang-upstream-weekly/2012.03.22.tar.gz |
Imported Upstream version 2012.03.22upstream-weekly/2012.03.22
Diffstat (limited to 'src/cmd/go/test.bash')
-rwxr-xr-x | src/cmd/go/test.bash | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/src/cmd/go/test.bash b/src/cmd/go/test.bash index daca144ee..541535101 100755 --- a/src/cmd/go/test.bash +++ b/src/cmd/go/test.bash @@ -22,37 +22,50 @@ do done # Test local (./) imports. -./testgo build -o hello testdata/local/easy.go -./hello >hello.out -if ! grep -q '^easysub\.Hello' hello.out; then - echo "testdata/local/easy.go did not generate expected output" - cat hello.out - ok=false -fi - -./testgo build -o hello testdata/local/easysub/main.go -./hello >hello.out -if ! grep -q '^easysub\.Hello' hello.out; then - echo "testdata/local/easysub/main.go did not generate expected output" - cat hello.out - ok=false -fi - -./testgo build -o hello testdata/local/hard.go -./hello >hello.out -if ! grep -q '^sub\.Hello' hello.out || ! grep -q '^subsub\.Hello' hello.out ; then - echo "testdata/local/hard.go did not generate expected output" - cat hello.out - ok=false -fi +testlocal() { + local="$1" + ./testgo build -o hello "testdata/$local/easy.go" + ./hello >hello.out + if ! grep -q '^easysub\.Hello' hello.out; then + echo "testdata/$local/easy.go did not generate expected output" + cat hello.out + ok=false + fi + + ./testgo build -o hello "testdata/$local/easysub/main.go" + ./hello >hello.out + if ! grep -q '^easysub\.Hello' hello.out; then + echo "testdata/$local/easysub/main.go did not generate expected output" + cat hello.out + ok=false + fi + + ./testgo build -o hello "testdata/$local/hard.go" + ./hello >hello.out + if ! grep -q '^sub\.Hello' hello.out || ! grep -q '^subsub\.Hello' hello.out ; then + echo "testdata/$local/hard.go did not generate expected output" + cat hello.out + ok=false + fi + + rm -f err.out hello.out hello + + # Test that go install x.go fails. + if ./testgo install "testdata/$local/easy.go" >/dev/null 2>&1; then + echo "go install testdata/$local/easy.go succeeded" + ok=false + fi +} -rm -f err.out hello.out hello +# Test local imports +testlocal local -# Test that go install x.go fails. -if ./testgo install testdata/local/easy.go >/dev/null 2>&1; then - echo "go install testdata/local/easy.go succeeded" - ok=false -fi +# Test local imports again, with bad characters in the directory name. +bad='#$%:, &()*;<=>?\^{}' +rm -rf "testdata/$bad" +cp -R testdata/local "testdata/$bad" +testlocal "$bad" +rm -rf "testdata/$bad" # Test tests with relative imports. if ! ./testgo test ./testdata/testimport; then |