Drop "any/" in module search; use 1.x-master
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Nicolas Williams · committed by Nicolas Williams · parent 287e2c9 · Browse files · 9 files·+30 added−47 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
9 files+30 added−47 removed
- tests:+26 added−43 removed
- other:+4 added−4 removed
Provenance
- Commit
8d2d5e3- Tree
2903675- Author
Nicolas Williams <nico@cryptonector.com>- Committer
Nicolas Williams <nico@cryptonector.com>- Parent
287e2c9
9 files changed+30 added−47 removed
added:tests/modules/1.4-master/b/b.jq+2 added
1+def a: "b";2+def b: "c";added:tests/modules/1.4-master/a.jq+2 added
1+module a {version:1.7};2+def a: "a";added:tests/modules/c/c.jq+5 added
1+module c {whatever:null};2+import a as foo;3+import d as d {search:"$ORIGIN/"};4+def a: 0;5+def c: foo::a + "c" + d::meh;added:tests/modules/c/d.jq+1 added
1+def meh: "meh";added:tests/modules/syntaxerror/syntaxerror.jq+1 added
1+wat;added:tests/modules/.jq+5 added
1+def foo: "baz";2+def f: "wat";3+def f: "foo";4+def g: "bar";5+def fg: f+g;modified:tests/run+10 added-43 removed
18 unmodified lines19 echo "Your OS does not support mktemp(1) -d" 1>&220 exit 021 fi22 23+24 ## Test constant folding25 26 # String constant folding (addition only)27 n=`$VALGRIND $Q ./jq -n --debug-dump-disasm '"foo"' | wc -l`45 unmodified lines73 fi74 75 v=`scripts/version`76 case "$v" in76-*-*) v=next;;77+*-*) v=`echo $v|sed -e 's/-.*$/-master/'`;;78 *) true;;79 esac80 81 ## Test library/module system82 82-cat > "$d/.jq" <<EOF83-def foo: "baz";84-def f: "wat";85-def f: "foo";86-def g: "bar";87-def fg: f+g;88-EOF83+mods=$PWD/tests/modules84 90-mkdir -p "$d/$v/b" "$d/any/c" "$d/any/syntaxerror"91-92-cat > "$d/$v/a.jq" <<EOF93-module a {version:1.7};94-def a: "a";95-EOF96-97-cat > "$d/$v/b/b.jq" <<EOF98-def a: "b";99-def b: "c";100-EOF101-102-cat > "$d/any/c/d.jq" <<EOF103-def meh: "meh";104-EOF105-106-cat > "$d/any/c/c.jq" <<"EOF"107-module c {whatever:null};108-import a as foo;109-import d as d {search:"$ORIGIN/"};110-def a: 0;111-def c: foo::a + "c" + d::meh;112-EOF113-114-cat > "$d/any/syntaxerror/syntaxerror.jq" <<EOF115-wat;116-EOF117-118-if [ "`HOME=$d $VALGRIND $Q ./jq -nr fg`" != foobar ]; then85+if [ "`HOME=$mods $VALGRIND $Q ./jq -nr fg`" != foobar ]; then86 echo "Bug #479 appears to be back" 1>&287 exit 188 fi89 123-if [ `HOME=$d $VALGRIND $Q ./jq --debug-dump-disasm -n fg | grep '^[a-z]' | wc -l` -gt 3 ]; then90+if [ `HOME=$mods $VALGRIND $Q ./jq --debug-dump-disasm -n fg | grep '^[a-z]' | wc -l` -gt 3 ]; then91 echo "Binding too many defs into program" 1>&292 exit 193 fi94 128-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; then95+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; then96 echo "Module system appears to be broken" 1>&297 exit 198 fi99 133-if ! $VALGRIND $Q ./jq -ner -L $d 'import c as foo; [foo::a, foo::c] | . == [0,"acmeh"]' > /dev/null; then100+if ! $VALGRIND $Q ./jq -ner -L $mods 'import c as foo; [foo::a, foo::c] | . == [0,"acmeh"]' > /dev/null; then101 echo "Module system appears to be broken" 1>&2102 exit 1103 fi104 138-if [ "`$VALGRIND $Q ./jq -cner -L $d '\"c\" | modulemeta'`" != '{"whatever":null,"name":"c","deps":[{"as":"foo","name":"a"},{"search":"$ORIGIN/","as":"d","name":"d"}]}' ]; then105+if [ "`$VALGRIND $Q ./jq -cner -L $mods '\"c\" | modulemeta'`" != '{"whatever":null,"name":"c","deps":[{"as":"foo","name":"a"},{"search":"$ORIGIN/","as":"d","name":"d"}]}' ]; then106 echo "modulemeta builtin appears to be broken" 1>&2107 exit 1108 fi109 143-if $VALGRIND ./jq -ner -L $d 'import syntaxerror; .' > $d/out 2>&1; then110+if $VALGRIND ./jq -ner -L $mods 'import syntaxerror; .' > $d/out 2>&1; then111 echo "Module system appears to be broken" 1>&2112 exit 1113 fi114 if [ -n "$VALGRIND" ] && ! grep 'ERROR SUMMARY: 0 errors from 0 contexts' $d/out > /dev/null; then5 unmodified lines120 echo "Module system not detecting syntax errors in modules correctly" 1>&2121 exit 1122 fi123 157-if $VALGRIND ./jq -ner -L $d '%::wat' > $d/out 2>&1 ||124+if $VALGRIND ./jq -ner -L $mods '%::wat' > $d/out 2>&1 ||125 ! grep '^jq: error: syntax error,' $d/out > /dev/null; then126 echo "Syntax errors not detected?" 1>&2127 exit 1128 fi5 unmodified linesmodified:linker.c+3 added-3 removed
86 unmodified lines87 }88 89 jv version_dirs;90 if (use_vers_dir) {91- version_dirs = JV_ARRAY(jv_string("any/"),92- jv_string_concat(jq_get_version_dir(jq),93- jv_string("/")));91+ jv vdir = jq_get_version_dir(jq);92+ assert(strchr(jv_string_value(vdir), '.') != NULL);93+ version_dirs = JV_ARRAY(jv_string(""), jv_string_concat(vdir, jv_string("/")));94 } else {95 version_dirs = JV_ARRAY(jv_string(""));96 }97 190 unmodified linesmodified:main.c+1 added-1 removed
363 unmodified lines364 365 if (strchr(JQ_VERSION, '-') == NULL)366 jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string(JQ_VERSION));367 else368- jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string("next"));368+ jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string_fmt("%.*s-master", strchr(JQ_VERSION, '-') - JQ_VERSION, JQ_VERSION));369 370 #if (!defined(WIN32) && defined(HAVE_ISATTY)) || defined(HAVE__ISATTY)371 372 #if defined(HAVE__ISATTY) && defined(isatty)129 unmodified lines