Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix tests. fixes #10

Make tests run on Darwin as well as Linux.

Also update tests to test current behavior of the buildpack
and the correct Go version.
  • Loading branch information...
commit d6be154b9bb5c259207fbea8faa67127c1a5d0b0 1 parent dcadd7f
@kr authored
View
4 bin/compile
@@ -7,7 +7,7 @@ mkdir -p "$1" "$2"
build=$(cd "$1/" && pwd)
cache=$(cd "$2/" && pwd)
ver=1.0.3
-file=go$ver.linux-amd64.tar.gz
+file=go$ver.$(uname|tr A-Z a-z)-amd64.tar.gz
url=http://go.googlecode.com/files/$file
buildpack=$(dirname $(dirname $0))
@@ -77,7 +77,7 @@ cp -R $build/* $p
unset GIT_DIR # unset git dir or it will mess with goinstall
echo "-----> Running: go get ./..."
cd $p
-go get ./... | sed -u 's/^/ /'
+go get ./...
mkdir -p $build/bin
mv $GOPATH/bin/* $build/bin
View
41 compile-test.sh
@@ -1,46 +1,30 @@
#!/bin/sh
-# Default Go version is r59
-rdir=$PWD/cache/src/go/release.r59
+ver=1.0.3
before() {
- mkdir -p build cache
- cp -r test/* build
+ rm -rf build cache
+ cp -r test build
+ mkdir cache
}
after() {
- rm -rf tmp build
+ rm -rf build cache
}
compile() {
- : === Compiling
sh bin/compile build cache 2>&1
- : === Done compiling
}
-# You can skip the long compile test by setting GOROOT
-[ -n "$GOROOT" ] &&
- mkdir -p $(dirname $rdir) &&
- rm -f $rdir &&
- # Fake a compile
- ln -s $GOROOT $rdir
-
-it_compiles_go() {
- # Skip this test if GOROOT is set
- [ -n "$GOROOT" ] && exit 0
-
- rm -rf cache
- mkdir cache
- ! test -f cache/src/go/release.r59/bin/gofmt
+it_installs_go() {
compile
- test -f cache/src/go/release.r59/bin/gofmt
+ test -f cache/go-$ver/go/bin/go
+ test -x cache/go-$ver/go/bin/go
}
it_skips_go_compile_if_exists() {
- # We don't delete the cache dir in the tests so this
- # doesn't need to rebuild Go.
- test -f cache/src/go/release.r59/bin/gofmt
- compile | grep "Skipping build"
+ mkdir -p cache/go-$ver/go
+ compile | grep Using
}
it_compiles_app() {
@@ -49,8 +33,3 @@ it_compiles_app() {
test -x build/bin/mytest
test "$(./build/bin/mytest 2>&1)" = "ok"
}
-
-it_deletes_cache() {
- # Here only to delete the cache dir
- rm -rf cache
-}
View
6 detect-test.sh
@@ -6,11 +6,11 @@ after() {
rm -rf detect-test
}
-it_is_go_if_go_files_under_src() {
+it_is_go_if_go_files() {
sh -x bin/detect detect-test/
}
-it_is_not_go_without_all_sh_or_go_files() {
- rm -rf detect-test/src/*
+it_is_not_go_without_go_files() {
+ rm -rf detect-test/*
! sh -x bin/detect detect-test/
}
View
1  test/.godir
@@ -0,0 +1 @@
+mytest
View
0  test/src/mytest/main.go → test/main.go
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.