enable tests that verify that pretty-printed code can be compiled with 6g again

R=r
OCL=17510
CL=17510
This commit is contained in:
Robert Griesemer 2008-10-20 17:13:02 -07:00
parent 6ae1df9b99
commit baac04b518
1 changed files with 23 additions and 12 deletions

View File

@ -17,13 +17,26 @@ count() {
} }
# apply to one file
apply1() { apply1() {
#echo $1 $2 #echo $1 $2
$1 $2 case `basename $F` in
count selftest.go | func3.go ) ;; # skip - these are test cases for syntax errors
* ) $1 $2; count ;;
esac
} }
# apply to local files
applydot() {
for F in *.go
do
apply1 $1 $F
done
}
# apply to all files in the list
apply() { apply() {
for F in \ for F in \
$GOROOT/usr/gri/pretty/*.go \ $GOROOT/usr/gri/pretty/*.go \
@ -34,10 +47,7 @@ apply() {
$GOROOT/src/lib/*/*.go \ $GOROOT/src/lib/*/*.go \
$GOROOT/usr/r/*/*.go $GOROOT/usr/r/*/*.go
do do
case `basename $F` in apply1 $1 $F
selftest.go | func3.go ) ;; # skip - these are test cases for syntax errors
* ) apply1 $1 $F ;;
esac
done done
} }
@ -85,21 +95,22 @@ valid() {
runtest() { runtest() {
#echo "Testing silent mode" #echo "Testing silent mode"
cleanup cleanup
$1 silent $2 $1 silent
#echo "Testing idempotency" #echo "Testing idempotency"
cleanup cleanup
$1 idempotent $2 $1 idempotent
#echo "Testing validity"
#cleanup
#$1 valid $2
} }
runtests() { runtests() {
if [ $# == 0 ]; then if [ $# == 0 ]; then
runtest apply runtest apply
# verify the pretty-printed files can be compiled with 6g again
# do it in local directory only because of the prerequisites required
#echo "Testing validity"
cleanup
applydot valid
else else
for F in $*; do for F in $*; do
runtest apply1 $F runtest apply1 $F