Browse Source

cover: move coverage test script to "tests"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
0e7f1100e3
2 changed files with 9 additions and 4 deletions
  1. 1 1
      test
  2. 8 3
      tests/cover.test.bash

+ 1 - 1
test

@@ -46,7 +46,7 @@ fi
 
 
 USERPKG=${PKG:-}
 USERPKG=${PKG:-}
 
 
-# Invoke ./cover for HTML output
+# Invoke ./tests/cover.test.bash for HTML output
 COVER=${COVER:-"-cover"}
 COVER=${COVER:-"-cover"}
 
 
 # Hack: gofmt ./ will recursively check the .git directory. So use *.go for gofmt.
 # Hack: gofmt ./ will recursively check the .git directory. So use *.go for gofmt.

+ 8 - 3
cover → tests/cover.test.bash

@@ -1,13 +1,18 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 #
 #
 # Generate coverage HTML for a package
 # Generate coverage HTML for a package
-# e.g. PKG=./unit ./cover
+# e.g. PKG=./unit ./tests/cover.test.bash
 #
 #
 set -e
 set -e
 
 
+if ! [[ "$0" =~ "tests/cover.test.bash" ]]; then
+  echo "must be run from repository root"
+  exit 255
+fi
+
 if [ -z "$PKG" ]; then
 if [ -z "$PKG" ]; then
-	echo "cover only works with a single package, sorry"
-	exit 255
+  echo "cover only works with a single package, sorry"
+  exit 255
 fi
 fi
 
 
 COVEROUT="coverage"
 COVEROUT="coverage"