From 8d2d5e37e54ecfa823f0a5c6e9644aa2e97d5ee6 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Wed, 20 Aug 2014 20:48:48 -0500 Subject: Drop "any/" in module search; use 1.x-master --- tests/modules/.jq | 5 +++ tests/modules/1.4-master/a.jq | 2 ++ tests/modules/1.4-master/b/b.jq | 2 ++ tests/modules/c/c.jq | 5 +++ tests/modules/c/d.jq | 1 + tests/modules/syntaxerror/syntaxerror.jq | 1 + tests/run | 55 +++++++------------------------- 7 files changed, 27 insertions(+), 44 deletions(-) create mode 100644 tests/modules/.jq create mode 100644 tests/modules/1.4-master/a.jq create mode 100644 tests/modules/1.4-master/b/b.jq create mode 100644 tests/modules/c/c.jq create mode 100644 tests/modules/c/d.jq create mode 100644 tests/modules/syntaxerror/syntaxerror.jq (limited to 'tests') diff --git a/tests/modules/.jq b/tests/modules/.jq new file mode 100644 index 00000000..69f37636 --- /dev/null +++ b/tests/modules/.jq @@ -0,0 +1,5 @@ +def foo: "baz"; +def f: "wat"; +def f: "foo"; +def g: "bar"; +def fg: f+g; diff --git a/tests/modules/1.4-master/a.jq b/tests/modules/1.4-master/a.jq new file mode 100644 index 00000000..1bf8d069 --- /dev/null +++ b/tests/modules/1.4-master/a.jq @@ -0,0 +1,2 @@ +module a {version:1.7}; +def a: "a"; diff --git a/tests/modules/1.4-master/b/b.jq b/tests/modules/1.4-master/b/b.jq new file mode 100644 index 00000000..3b69e966 --- /dev/null +++ b/tests/modules/1.4-master/b/b.jq @@ -0,0 +1,2 @@ +def a: "b"; +def b: "c"; diff --git a/tests/modules/c/c.jq b/tests/modules/c/c.jq new file mode 100644 index 00000000..2d355ed3 --- /dev/null +++ b/tests/modules/c/c.jq @@ -0,0 +1,5 @@ +module c {whatever:null}; +import a as foo; +import d as d {search:"$ORIGIN/"}; +def a: 0; +def c: foo::a + "c" + d::meh; diff --git a/tests/modules/c/d.jq b/tests/modules/c/d.jq new file mode 100644 index 00000000..3d11a18b --- /dev/null +++ b/tests/modules/c/d.jq @@ -0,0 +1 @@ +def meh: "meh"; diff --git a/tests/modules/syntaxerror/syntaxerror.jq b/tests/modules/syntaxerror/syntaxerror.jq new file mode 100644 index 00000000..0acc5495 --- /dev/null +++ b/tests/modules/syntaxerror/syntaxerror.jq @@ -0,0 +1 @@ +wat; diff --git a/tests/run b/tests/run index 8a4ef0e7..0b5fcafc 100755 --- a/tests/run +++ b/tests/run @@ -20,6 +20,7 @@ if [ -z "$d" ]; then exit 0 fi + ## Test constant folding # String constant folding (addition only) @@ -73,74 +74,40 @@ fi v=`scripts/version` case "$v" in -*-*) v=next;; +*-*) v=`echo $v|sed -e 's/-.*$/-master/'`;; *) true;; esac ## Test library/module system -cat > "$d/.jq" < "$d/$v/a.jq" < "$d/$v/b/b.jq" < "$d/any/c/d.jq" < "$d/any/c/c.jq" <<"EOF" -module c {whatever:null}; -import a as foo; -import d as d {search:"$ORIGIN/"}; -def a: 0; -def c: foo::a + "c" + d::meh; -EOF - -cat > "$d/any/syntaxerror/syntaxerror.jq" <&2 exit 1 fi -if [ `HOME=$d $VALGRIND $Q ./jq --debug-dump-disasm -n fg | grep '^[a-z]' | wc -l` -gt 3 ]; then +if [ `HOME=$mods $VALGRIND $Q ./jq --debug-dump-disasm -n fg | grep '^[a-z]' | wc -l` -gt 3 ]; then echo "Binding too many defs into program" 1>&2 exit 1 fi -if ! $VALGRIND $Q ./jq -ner -L $d 'import a as foo; import b as bar; import a; def fooa: foo::a; [fooa, bar::a, bar::b, foo::a, a] | . == ["a","b","c","a","a"]' > /dev/null; then +if ! $VALGRIND $Q ./jq -ner -L $mods 'import a as foo; import b as bar; import a; def fooa: foo::a; [fooa, bar::a, bar::b, foo::a, a] | . == ["a","b","c","a","a"]' > /dev/null; then echo "Module system appears to be broken" 1>&2 exit 1 fi -if ! $VALGRIND $Q ./jq -ner -L $d 'import c as foo; [foo::a, foo::c] | . == [0,"acmeh"]' > /dev/null; then +if ! $VALGRIND $Q ./jq -ner -L $mods 'import c as foo; [foo::a, foo::c] | . == [0,"acmeh"]' > /dev/null; then echo "Module system appears to be broken" 1>&2 exit 1 fi -if [ "`$VALGRIND $Q ./jq -cner -L $d '\"c\" | modulemeta'`" != '{"whatever":null,"name":"c","deps":[{"as":"foo","name":"a"},{"search":"$ORIGIN/","as":"d","name":"d"}]}' ]; then +if [ "`$VALGRIND $Q ./jq -cner -L $mods '\"c\" | modulemeta'`" != '{"whatever":null,"name":"c","deps":[{"as":"foo","name":"a"},{"search":"$ORIGIN/","as":"d","name":"d"}]}' ]; then echo "modulemeta builtin appears to be broken" 1>&2 exit 1 fi -if $VALGRIND ./jq -ner -L $d 'import syntaxerror; .' > $d/out 2>&1; then +if $VALGRIND ./jq -ner -L $mods 'import syntaxerror; .' > $d/out 2>&1; then echo "Module system appears to be broken" 1>&2 exit 1 fi @@ -154,7 +121,7 @@ if ! grep '^jq: error: syntax error,' $d/out > /dev/null; then exit 1 fi -if $VALGRIND ./jq -ner -L $d '%::wat' > $d/out 2>&1 || +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 -- cgit v1.2.3