1
0
mirror of https://github.com/golang/go synced 2024-11-22 02:54:39 -07:00

gotest: if the benchmark list is empty, print it in a way that

gofmt will leave alone.

R=rsc, bradfitz, bradfitzpatrick
CC=golang-dev
https://golang.org/cl/2816041
This commit is contained in:
Rob Pike 2010-11-01 14:23:07 -07:00
parent 6442f38a91
commit e8436689ad

View File

@ -153,17 +153,23 @@ importpath=$(gomake -s importpath)
echo 'var tests = []testing.Test{'
for i in $tests
do
echo ' testing.Test{"'$i'", '$i'},'
echo ' {"'$i'", '$i'},'
done
echo '}'
# benchmark array
if [ "$benchmarks" = "" ]
then
# keep the empty array gofmt-safe.
# (not an issue for the test array, which is never empty.)
echo 'var benchmarks = []testing.InternalBenchmark{}'
else
echo 'var benchmarks = []testing.InternalBenchmark{'
for i in $benchmarks
do
echo ' testing.InternalBenchmark{"'$i'", '$i'},'
echo ' {"'$i'", '$i'},'
done
echo '}'
fi
# body
echo
echo 'func main() {'