mirror of
https://github.com/golang/go
synced 2024-11-22 03:44: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:
parent
6442f38a91
commit
e8436689ad
@ -153,17 +153,23 @@ importpath=$(gomake -s importpath)
|
|||||||
echo 'var tests = []testing.Test{'
|
echo 'var tests = []testing.Test{'
|
||||||
for i in $tests
|
for i in $tests
|
||||||
do
|
do
|
||||||
echo ' testing.Test{"'$i'", '$i'},'
|
echo ' {"'$i'", '$i'},'
|
||||||
done
|
done
|
||||||
echo '}'
|
echo '}'
|
||||||
# benchmark array
|
# benchmark array
|
||||||
echo 'var benchmarks = []testing.InternalBenchmark{'
|
if [ "$benchmarks" = "" ]
|
||||||
for i in $benchmarks
|
then
|
||||||
do
|
# keep the empty array gofmt-safe.
|
||||||
echo ' testing.InternalBenchmark{"'$i'", '$i'},'
|
# (not an issue for the test array, which is never empty.)
|
||||||
done
|
echo 'var benchmarks = []testing.InternalBenchmark{}'
|
||||||
echo '}'
|
else
|
||||||
|
echo 'var benchmarks = []testing.InternalBenchmark{'
|
||||||
|
for i in $benchmarks
|
||||||
|
do
|
||||||
|
echo ' {"'$i'", '$i'},'
|
||||||
|
done
|
||||||
|
echo '}'
|
||||||
|
fi
|
||||||
# body
|
# body
|
||||||
echo
|
echo
|
||||||
echo 'func main() {'
|
echo 'func main() {'
|
||||||
|
Loading…
Reference in New Issue
Block a user