mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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
This commit is contained in:
parent
480b962df5
commit
92cff8557e
2 changed files with 15 additions and 6 deletions
|
|
@ -55,13 +55,22 @@ trap "rm -f _testmain.go _testmain.6" 0 1 2 3 14 15
|
|||
# test array
|
||||
echo
|
||||
echo 'var tests = &[]testing.Test {'
|
||||
for ofile in $ofiles
|
||||
do
|
||||
# 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/·/./')
|
||||
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
|
||||
echo
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export func Main(tests *[]Test) {
|
|||
flag.Parse();
|
||||
ok := true;
|
||||
if len(tests) == 0 {
|
||||
println("gotest: warning: no tests to run");
|
||||
println("testing: warning: no tests to run");
|
||||
}
|
||||
for i := 0; i < len(tests); i++ {
|
||||
if chatty {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue