Commit e8436689 authored by Rob Pike's avatar Rob Pike

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
parent 6442f38a
......@@ -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
echo 'var benchmarks = []testing.InternalBenchmark{'
for i in $benchmarks
do
echo ' testing.InternalBenchmark{"'$i'", '$i'},'
done
echo '}'
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 ' {"'$i'", '$i'},'
done
echo '}'
fi
# body
echo
echo 'func main() {'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment