test: Improve test depth

Make sure we're catching everything, including new, deeper code.
This commit is contained in:
James Shubin
2019-03-12 15:50:30 -04:00
parent 6044ade373
commit 58961d23bb
5 changed files with 9 additions and 6 deletions

View File

@@ -22,7 +22,7 @@ ln -s "$linkto" # symlink outside of dir
cd `basename "$linkto"` cd `basename "$linkto"`
# loop through individual *.go files in working dir # loop through individual *.go files in working dir
for file in `find . -maxdepth 3 -type f -name '*.go'`; do for file in `find . -maxdepth 9 -type f -name '*.go'`; do
#echo "running test on: $file" #echo "running test on: $file"
run-test go build -i -o "$buildout" "$file" || fail_test "could not build: $file" run-test go build -i -o "$buildout" "$file" || fail_test "could not build: $file"
done done

View File

@@ -27,7 +27,7 @@ if [ "$COMMITS" != "" ] && [ "$COMMITS" -gt "1" ]; then
fi fi
# find all go files, exluding temporary directories and generated files # find all go files, exluding temporary directories and generated files
LINT=$(find * -maxdepth 5 -iname '*.go' -not -path 'old/*' -not -path 'tmp/*' -not -path 'bindata/*' -not -path 'lang/y.go' -not -path 'lang/lexer.nn.go' -not -path 'vendor/*' -exec golint {} \;) # current golint output LINT=$(find * -maxdepth 9 -iname '*.go' -not -path 'old/*' -not -path 'tmp/*' -not -path 'bindata/*' -not -path 'lang/y.go' -not -path 'lang/lexer.nn.go' -not -path 'vendor/*' -exec golint {} \;) # current golint output
COUNT=`echo -e "$LINT" | wc -l` # number of golint problems in current branch COUNT=`echo -e "$LINT" | wc -l` # number of golint problems in current branch
[ "$LINT" = "" ] && echo PASS && exit # everything is "perfect" [ "$LINT" = "" ] && echo PASS && exit # everything is "perfect"
@@ -55,7 +55,7 @@ while read -r line; do
done <<< "$NUMSTAT1" # three < is the secret to putting a variable into read done <<< "$NUMSTAT1" # three < is the secret to putting a variable into read
git checkout "$PREVIOUS" &>/dev/null # previous commit git checkout "$PREVIOUS" &>/dev/null # previous commit
LINT1=$(find * -maxdepth 5 -iname '*.go' -not -path 'old/*' -not -path 'tmp/*' -not -path 'bindata/*' -not -path 'lang/y.go' -not -path 'lang/lexer.nn.go' -not -path 'vendor/*' -exec golint {} \;) LINT1=$(find * -maxdepth 9 -iname '*.go' -not -path 'old/*' -not -path 'tmp/*' -not -path 'bindata/*' -not -path 'lang/y.go' -not -path 'lang/lexer.nn.go' -not -path 'vendor/*' -exec golint {} \;)
COUNT1=`echo -e "$LINT1" | wc -l` # number of golint problems in older branch COUNT1=`echo -e "$LINT1" | wc -l` # number of golint problems in older branch
# clean up # clean up

View File

@@ -54,7 +54,7 @@ echo "Using: $gometalinter"
# loop through directories in an attempt to scan each go package # loop through directories in an attempt to scan each go package
# TODO: lint the *.go examples as individual files and not as a single *.go # TODO: lint the *.go examples as individual files and not as a single *.go
for dir in `find * -maxdepth 5 -type d -not -path 'old/*' -not -path 'old' -not -path 'tmp/*' -not -path 'tmp' -not -path 'vendor/*' -not -path 'examples/*' -not -path 'test/*'`; do for dir in `find * -maxdepth 9 -type d -not -path 'old/*' -not -path 'old' -not -path 'tmp/*' -not -path 'tmp' -not -path 'vendor/*' -not -path 'examples/*' -not -path 'test/*'`; do
#echo "Running in: $dir" #echo "Running in: $dir"
match="$dir/*.go" match="$dir/*.go"

View File

@@ -75,7 +75,10 @@ for pkg in `go list -e ./... | grep -v "^${base}/vendor/" | grep -v "^${base}/ex
done done
# loop through individual *.go files # loop through individual *.go files
for file in `find . -maxdepth 3 -type f -name '*.go' -not -path './old/*' -not -path './tmp/*'`; do for file in `find . -maxdepth 9 -type f -name '*.go' -not -path './old/*' -not -path './tmp/*' -not -path 'vendor/*'`; do
#if [[ $file == "./vendor/"* ]]; then # skip files that start with...
# continue
#fi
run-test grep 'log.Print' "$file" | grep '\\n"' && fail_test 'no newline needed in log.Print*()' # no \n needed in log.Printf or log.Println run-test grep 'log.Print' "$file" | grep '\\n"' && fail_test 'no newline needed in log.Print*()' # no \n needed in log.Printf or log.Println
run-test simplify-gocase "$file" run-test simplify-gocase "$file"
run-test token-coloncheck "$file" run-test token-coloncheck "$file"

View File

@@ -39,7 +39,7 @@ function parser-conflicts() {
} }
# loop through individual *.y files # loop through individual *.y files
for file in `find . -maxdepth 3 -type f -name '*.y' -not -path './old/*' -not -path './tmp/*'`; do for file in `find . -maxdepth 9 -type f -name '*.y' -not -path './old/*' -not -path './tmp/*' -not -path 'vendor/*'`; do
run-test parser-indentation "$file" run-test parser-indentation "$file"
run-test parser-conflicts "$file" run-test parser-conflicts "$file"
done done