diff --git a/testsuite/compiler/canonical/.gitignore b/testsuite/canonical/.gitignore similarity index 100% rename from testsuite/compiler/canonical/.gitignore rename to testsuite/canonical/.gitignore diff --git a/testsuite/compiler/canonical/FoodsFin.gf.gold b/testsuite/canonical/gold/FoodsFin.gf similarity index 100% rename from testsuite/compiler/canonical/FoodsFin.gf.gold rename to testsuite/canonical/gold/FoodsFin.gf diff --git a/testsuite/compiler/canonical/Foods.gf b/testsuite/canonical/grammars/Foods.gf similarity index 100% rename from testsuite/compiler/canonical/Foods.gf rename to testsuite/canonical/grammars/Foods.gf diff --git a/testsuite/compiler/canonical/FoodsFin.gf b/testsuite/canonical/grammars/FoodsFin.gf similarity index 100% rename from testsuite/compiler/canonical/FoodsFin.gf rename to testsuite/canonical/grammars/FoodsFin.gf diff --git a/testsuite/compiler/canonical/FoodsI.gf b/testsuite/canonical/grammars/FoodsI.gf similarity index 100% rename from testsuite/compiler/canonical/FoodsI.gf rename to testsuite/canonical/grammars/FoodsI.gf diff --git a/testsuite/compiler/canonical/Greetings.gf b/testsuite/canonical/grammars/Greetings.gf similarity index 100% rename from testsuite/compiler/canonical/Greetings.gf rename to testsuite/canonical/grammars/Greetings.gf diff --git a/testsuite/compiler/canonical/GreetingsBul.gf b/testsuite/canonical/grammars/GreetingsBul.gf similarity index 100% rename from testsuite/compiler/canonical/GreetingsBul.gf rename to testsuite/canonical/grammars/GreetingsBul.gf diff --git a/testsuite/compiler/canonical/GreetingsGer.gf b/testsuite/canonical/grammars/GreetingsGer.gf similarity index 100% rename from testsuite/compiler/canonical/GreetingsGer.gf rename to testsuite/canonical/grammars/GreetingsGer.gf diff --git a/testsuite/compiler/canonical/LexFoods.gf b/testsuite/canonical/grammars/LexFoods.gf similarity index 100% rename from testsuite/compiler/canonical/LexFoods.gf rename to testsuite/canonical/grammars/LexFoods.gf diff --git a/testsuite/compiler/canonical/LexFoodsFin.gf b/testsuite/canonical/grammars/LexFoodsFin.gf similarity index 100% rename from testsuite/compiler/canonical/LexFoodsFin.gf rename to testsuite/canonical/grammars/LexFoodsFin.gf diff --git a/testsuite/compiler/canonical/Phrasebook.gf b/testsuite/canonical/grammars/Phrasebook.gf similarity index 100% rename from testsuite/compiler/canonical/Phrasebook.gf rename to testsuite/canonical/grammars/Phrasebook.gf diff --git a/testsuite/compiler/canonical/PhrasebookBul.gf b/testsuite/canonical/grammars/PhrasebookBul.gf similarity index 100% rename from testsuite/compiler/canonical/PhrasebookBul.gf rename to testsuite/canonical/grammars/PhrasebookBul.gf diff --git a/testsuite/compiler/canonical/PhrasebookGer.gf b/testsuite/canonical/grammars/PhrasebookGer.gf similarity index 100% rename from testsuite/compiler/canonical/PhrasebookGer.gf rename to testsuite/canonical/grammars/PhrasebookGer.gf diff --git a/testsuite/compiler/canonical/Sentences.gf b/testsuite/canonical/grammars/Sentences.gf similarity index 100% rename from testsuite/compiler/canonical/Sentences.gf rename to testsuite/canonical/grammars/Sentences.gf diff --git a/testsuite/compiler/canonical/SentencesBul.gf b/testsuite/canonical/grammars/SentencesBul.gf similarity index 100% rename from testsuite/compiler/canonical/SentencesBul.gf rename to testsuite/canonical/grammars/SentencesBul.gf diff --git a/testsuite/compiler/canonical/SentencesGer.gf b/testsuite/canonical/grammars/SentencesGer.gf similarity index 100% rename from testsuite/compiler/canonical/SentencesGer.gf rename to testsuite/canonical/grammars/SentencesGer.gf diff --git a/testsuite/compiler/canonical/SentencesI.gf b/testsuite/canonical/grammars/SentencesI.gf similarity index 100% rename from testsuite/compiler/canonical/SentencesI.gf rename to testsuite/canonical/grammars/SentencesI.gf diff --git a/testsuite/compiler/canonical/Words.gf b/testsuite/canonical/grammars/Words.gf similarity index 100% rename from testsuite/compiler/canonical/Words.gf rename to testsuite/canonical/grammars/Words.gf diff --git a/testsuite/compiler/canonical/WordsBul.gf b/testsuite/canonical/grammars/WordsBul.gf similarity index 100% rename from testsuite/compiler/canonical/WordsBul.gf rename to testsuite/canonical/grammars/WordsBul.gf diff --git a/testsuite/compiler/canonical/WordsGer.gf b/testsuite/canonical/grammars/WordsGer.gf similarity index 100% rename from testsuite/compiler/canonical/WordsGer.gf rename to testsuite/canonical/grammars/WordsGer.gf diff --git a/testsuite/canonical/run.sh b/testsuite/canonical/run.sh new file mode 100755 index 000000000..7e5a90f12 --- /dev/null +++ b/testsuite/canonical/run.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env sh + +FAILURES=0 + +# https://github.com/GrammaticalFramework/gf-core/issues/100 +stack run -- --batch --output-format=canonical_gf grammars/PhrasebookBul.gf +stack run -- --batch canonical/PhrasebookBul.gf +if [ $? -ne 0 ]; then + echo "Canonical grammar doesn't compile: FAIL" + FAILURES=$((FAILURES+1)) +else + echo "Canonical grammar compiles: OK" +fi + +# https://github.com/GrammaticalFramework/gf-core/issues/101 +stack run -- --batch --output-format=canonical_gf grammars/PhrasebookGer.gf +for s in c2 objCtrl; do + grep VRead --after-context=216 canonical/PhrasebookGer.gf | grep "$s" > /dev/null + if [ $? -ne 1 ]; then + echo "Canonical grammar contains `$s`: FAIL" + FAILURES=$((FAILURES+1)) + else + echo "Canonical grammar does not contain `$s`: OK" + fi +done + +# https://github.com/GrammaticalFramework/gf-core/issues/102 +stack run -- --batch --output-format=canonical_gf grammars/FoodsFin.gf +diff canonical/FoodsFin.gf gold/FoodsFin.gf +if [ $? -ne 0 ]; then + echo "Canonical grammar doesn't match gold version: FAIL" + FAILURES=$((FAILURES+1)) +else + echo "Canonical grammar matches gold version: OK" +fi + +if [ $FAILURES -ne 0 ]; then + echo "Failures: $FAILURES" + exit 1 +else + echo "All tests passed" +fi diff --git a/testsuite/compiler/canonical/run.sh b/testsuite/compiler/canonical/run.sh deleted file mode 100755 index b9cc7e25b..000000000 --- a/testsuite/compiler/canonical/run.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env sh - -# https://github.com/GrammaticalFramework/gf-core/issues/100 -stack run -- --batch --output-format=canonical_gf PhrasebookBul.gf -stack run -- --batch canonical/PhrasebookBul.gf - -# https://github.com/GrammaticalFramework/gf-core/issues/101 -stack run -- --batch --output-format=canonical_gf PhrasebookGer.gf -for s in c2 objCtrl; do - grep VRead --after-context=216 canonical/PhrasebookGer.gf | grep "$s" > /dev/null - if [ $? -ne 1 ]; then - echo "$s found" - exit 1 - fi -done - -# https://github.com/GrammaticalFramework/gf-core/issues/102 -stack run -- --batch --output-format=canonical_gf FoodsFin.gf -diff canonical/FoodsFin.gf ./FoodsFin.gf.gold -if [ $? -ne 0 ]; then - echo "Compiled grammar doesn't match gold version" - exit 1 -fi