summaryrefslogtreecommitdiff
path: root/src/cmd/gotest
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2008-11-25 12:49:17 -0800
committerRuss Cox <rsc@golang.org>2008-11-25 12:49:17 -0800
commita90c7afa430ab2e9164ba03fa2f75403fe2218a1 (patch)
treece551e6c8d3b441074c6f1453ca1491970bdbb0b /src/cmd/gotest
parentfcb77c69ef76c8b95151abebf279d63147395355 (diff)
downloadgolang-a90c7afa430ab2e9164ba03fa2f75403fe2218a1.tar.gz
gotest: change pattern to Test([^a-z].*)?
warn about files with no tests be clear about where testing warnings come from R=r DELTA=18 (12 added, 3 deleted, 3 changed) OCL=19988 CL=19993
Diffstat (limited to 'src/cmd/gotest')
-rwxr-xr-xsrc/cmd/gotest/gotest19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/cmd/gotest/gotest b/src/cmd/gotest/gotest
index 55d22e729..744a7f3c8 100755
--- a/src/cmd/gotest/gotest
+++ b/src/cmd/gotest/gotest
@@ -55,12 +55,21 @@ trap "rm -f _testmain.go _testmain.6" 0 1 2 3 14 15
# test array
echo
echo 'var tests = &[]testing.Test {'
- # test functions are named TestFoo
- # the grep -v eliminates methods and other special names
- # that have multiple dots.
- for i in $(6nm -s $ofiles | grep ' T .*·Test[A-Z]' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
+ for ofile in $ofiles
do
- echo ' testing.Test{ "'$i'", &'$i' },'
+ # test functions are named TestFoo
+ # the grep -v eliminates methods and other special names
+ # that have multiple dots.
+ pattern='Test([^a-z].*)?'
+ tests=$(6nm -s $ofile | egrep ' T .*·'$pattern'$' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
+ if [ "x$tests" = x ]; then
+ echo 'gotest: warning: no tests matching '$pattern' in '$ofile 1>&2
+ else
+ for i in $tests
+ do
+ echo ' testing.Test{ "'$i'", &'$i' },'
+ done
+ fi
done
echo '}'
# body