Drop "any/" in module search; use 1.x-master
This commit is contained in:
1 parent
287e2c96ed
commit
8d2d5e37e5
9 files changed
+30
-47
No files matched your search
@@ -88,9 +88,9 @@ static jv find_lib(jq_state *jq, jv lib_name, jv lib_search_path, int use_vers_d
|
||||
|
||||
jv version_dirs;
|
||||
if (use_vers_dir) {
|
||||
version_dirs = JV_ARRAY(jv_string("any/"),
|
||||
jv_string_concat(jq_get_version_dir(jq),
|
||||
jv_string("/")));
|
||||
jv vdir = jq_get_version_dir(jq);
|
||||
assert(strchr(jv_string_value(vdir), '.') != NULL);
|
||||
version_dirs = JV_ARRAY(jv_string(""), jv_string_concat(vdir, jv_string("/")));
|
||||
} else {
|
||||
version_dirs = JV_ARRAY(jv_string(""));
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ int main(int argc, char* argv[]) {
|
||||
if (strchr(JQ_VERSION, '-') == NULL)
|
||||
jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string(JQ_VERSION));
|
||||
else
|
||||
jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string("next"));
|
||||
jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string_fmt("%.*s-master", strchr(JQ_VERSION, '-') - JQ_VERSION, JQ_VERSION));
|
||||
|
||||
#if (!defined(WIN32) && defined(HAVE_ISATTY)) || defined(HAVE__ISATTY)
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
def foo: "baz";
|
||||
def f: "wat";
|
||||
def f: "foo";
|
||||
def g: "bar";
|
||||
def fg: f+g;
|
||||
@@ -0,0 +1,2 @@
|
||||
module a {version:1.7};
|
||||
def a: "a";
|
||||
@@ -0,0 +1,2 @@
|
||||
def a: "b";
|
||||
def b: "c";
|
||||
@@ -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;
|
||||
@@ -0,0 +1 @@
|
||||
def meh: "meh";
|
||||
@@ -0,0 +1 @@
|
||||
wat;
|
||||
@@ -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" <<EOF
|
||||
def foo: "baz";
|
||||
def f: "wat";
|
||||
def f: "foo";
|
||||
def g: "bar";
|
||||
def fg: f+g;
|
||||
EOF
|
||||
mods=$PWD/tests/modules
|
||||
|
||||
mkdir -p "$d/$v/b" "$d/any/c" "$d/any/syntaxerror"
|
||||
|
||||
cat > "$d/$v/a.jq" <<EOF
|
||||
module a {version:1.7};
|
||||
def a: "a";
|
||||
EOF
|
||||
|
||||
cat > "$d/$v/b/b.jq" <<EOF
|
||||
def a: "b";
|
||||
def b: "c";
|
||||
EOF
|
||||
|
||||
cat > "$d/any/c/d.jq" <<EOF
|
||||
def meh: "meh";
|
||||
EOF
|
||||
|
||||
cat > "$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" <<EOF
|
||||
wat;
|
||||
EOF
|
||||
|
||||
if [ "`HOME=$d $VALGRIND $Q ./jq -nr fg`" != foobar ]; then
|
||||
if [ "`HOME=$mods $VALGRIND $Q ./jq -nr fg`" != foobar ]; then
|
||||
echo "Bug #479 appears to be back" 1>&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
|
||||
|
||||
Reference in new issue
Block a user