test: Add a test to ensure the parser doesn't have any conflicts
Our grammar shouldn't be ambiguous, and it makes sense to test this.
This commit is contained in:
@@ -29,9 +29,19 @@ function parser-indentation() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parser-conflicts() {
|
||||||
|
# in the test, run goyacc, but don't leave any output files around
|
||||||
|
if goyacc -o /dev/null -v /dev/null "$1" | grep 'conflict'; then # grammar is ambiguous
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# 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 3 -type f -name '*.y' -not -path './old/*' -not -path './tmp/*'`; do
|
||||||
run-test parser-indentation "$file"
|
run-test parser-indentation "$file"
|
||||||
|
run-test parser-conflicts "$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n "$failures" ]]; then
|
if [[ -n "$failures" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user