From df3da02848bd2485da60915fca92f4184fb4138d Mon Sep 17 00:00:00 2001 From: Ken Domino Date: Wed, 15 May 2024 07:34:48 -0400 Subject: [PATCH] Add tests. --- tests/grammars/Up2.g4 | 2 ++ tests/grammars/Up3.g4 | 2 ++ tests/test.sh | 14 +++++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 tests/grammars/Up2.g4 create mode 100644 tests/grammars/Up3.g4 diff --git a/tests/grammars/Up2.g4 b/tests/grammars/Up2.g4 new file mode 100644 index 0000000..c087712 --- /dev/null +++ b/tests/grammars/Up2.g4 @@ -0,0 +1,2 @@ +grammar Up2; +start: a ( b | c )* d; diff --git a/tests/grammars/Up3.g4 b/tests/grammars/Up3.g4 new file mode 100644 index 0000000..0d2eabf --- /dev/null +++ b/tests/grammars/Up3.g4 @@ -0,0 +1,2 @@ +grammar Up3; +start: a ( v += b )* c; diff --git a/tests/test.sh b/tests/test.sh index e122a86..9c62f5c 100644 --- a/tests/test.sh +++ b/tests/test.sh @@ -7,10 +7,18 @@ where=`pwd` cd "$where" echo "$where" cd "$where" -bash ../find-useless-parentheses.sh grammars/Up1.g4 -if [ $? -ne 0 ] +failed=0 +for t in grammars/*.g4 +do + bash ../find-useless-parentheses.sh $t + if [ $? -ne 0 ] + then + echo Test "'bash ../find-useless-parentheses.sh $t'" failed. + failed=1 + fi +done +if [ $failed -ne 0 ] then - echo Test "'bash ../find-useless-parentheses.sh grammars/Up1.g4'" failed. exit 1 else exit 0