diff options
author | Nicolas Williams <nico@cryptonector.com> | 2014-12-31 19:21:45 -0600 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2014-12-31 20:09:53 -0600 |
commit | 86bc662bd2b89f66e0ce60b0ab3df5de43701f50 (patch) | |
tree | bf27c6c10aea40e1b7764f5d6ac5d89eb60ab8c1 /tests | |
parent | ae7f8d6ab9d29bd72f462fdafa4d7a9270706d3b (diff) |
Move some module tests into all.test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/all.test | 25 | ||||
-rwxr-xr-x | tests/run | 59 |
2 files changed, 30 insertions, 54 deletions
diff --git a/tests/all.test b/tests/all.test index 67b80763..cdb34d63 100644 --- a/tests/all.test +++ b/tests/all.test @@ -1124,3 +1124,28 @@ bsearch(4) [1,2,3] -4 +# module system +import "a" as foo; import "b" as bar; def fooa: foo::a; [fooa, bar::a, bar::b, foo::a] +null +["a","b","c","a"] + +import "c" as foo; [foo::a, foo::c] +null +[0,"acmehbah"] + +modulemeta +"c" +{"whatever":null,"deps":[{"as":"foo","is_data":false,"relpath":"a"},{"search":"./","as":"d","is_data":false,"relpath":"d"},{"search":"./","as":"d2","is_data":false,"relpath":"d"},{"search":"./../lib/jq","as":"e","is_data":false,"relpath":"e"},{"search":"./../lib/jq","as":"f","is_data":false,"relpath":"f"},{"as":"d","is_data":true,"relpath":"data"}]} + +%%FAIL +import "syntaxerror" as e; . +jq: error: syntax error, unexpected ';', expecting $end (Unix shell quoting issues?) + +%%FAIL +%::wat +jq: error: syntax error, unexpected '%', expecting $end (Unix shell quoting issues?) + +import "test_bind_order" as check; check::check +null +true + @@ -10,11 +10,11 @@ else Q= fi -cat $@ | $VALGRIND $Q ./jq --run-tests +mods=$PWD/tests/modules -set -x +cat $@ | $VALGRIND $Q ./jq -L "$mods" --run-tests -mods=$PWD/tests/modules +set -x clean=true d= @@ -190,6 +190,8 @@ clean=true ## Test library/module system +# Check handling of ~/.jq; these can't move into jq_test.c yet because +# they depend on $HOME if [ "`HOME="$mods" $VALGRIND $Q ./jq -nr fg`" != foobar ]; then echo "Bug #479 appears to be back" 1>&2 exit 1 @@ -200,55 +202,4 @@ if [ `HOME="$mods" $VALGRIND $Q ./jq --debug-dump-disasm -n fg | grep '^[a-z]' | exit 1 fi -if ! $VALGRIND $Q ./jq -ner -L "$mods" 'import "a" as foo; import "b" as bar; def fooa: foo::a; [fooa, bar::a, bar::b, foo::a] | . == ["a","b","c","a"]' > /dev/null; then - echo "Module system appears to be broken" 1>&2 - exit 1 -fi - -if ! $VALGRIND $Q ./jq -ner -L "$mods" 'import "c" as foo; [foo::a, foo::c] | . == [0,"acmehbah"]' > /dev/null; then - echo "Module system appears to be broken" 1>&2 - exit 1 -fi - -if [ "`$VALGRIND $Q ./jq -cner -L "$mods" '\"c\" | modulemeta'`" != '{"whatever":null,"deps":[{"as":"foo","is_data":false,"relpath":"a"},{"search":"./","as":"d","is_data":false,"relpath":"d"},{"search":"./","as":"d2","is_data":false,"relpath":"d"},{"search":"./../lib/jq","as":"e","is_data":false,"relpath":"e"},{"search":"./../lib/jq","as":"f","is_data":false,"relpath":"f"},{"as":"d","is_data":true,"relpath":"data"}]}' ]; then - echo "modulemeta builtin appears to be broken" 1>&2 - exit 1 -fi - -if $VALGRIND ./jq -ner -L "$mods" 'import "syntaxerror" as e; .' > $d/out 2>&1; then - echo "Module system appears to be broken" 1>&2 - exit 1 -fi -if [ -n "$VALGRIND" ] && ! grep 'ERROR SUMMARY: 0 errors from 0 contexts' $d/out > /dev/null; then - echo "Module system has memory errors when modules have syntax errors" 1>&2 - cat $d/out - exit 1 -fi -if ! grep '^jq: error: syntax error,' $d/out > /dev/null; then - echo "Module system not detecting syntax errors in modules correctly" 1>&2 - exit 1 -fi - -if $VALGRIND ./jq -ner -L "$mods" '%::wat' > $d/out 2>&1 || - ! grep '^jq: error: syntax error,' $d/out > /dev/null; then - echo "Syntax errors not detected?" 1>&2 - exit 1 -fi -if [ -n "$VALGRIND" ] && ! grep 'ERROR SUMMARY: 0 errors from 0 contexts' $d/out > /dev/null; then - echo "Memory errors when programs have syntax errors" 1>&2 - cat $d/out - exit 1 -fi - -if ! $VALGRIND ./jq -ner -L "$mods" -f "$mods/test_bind_order.jq" > $d/out 2>&1; then - echo "Import bind order is broken" 1>&2 - exit 1 -fi - -if [ -n "$VALGRIND" ] && ! grep 'ERROR SUMMARY: 0 errors from 0 contexts' $d/out > /dev/null; then - echo "Memory errors when programs have syntax errors" 1>&2 - cat $d/out - exit 1 -fi - exit 0 |