@port-labs/jq-node-bindings 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/.editorconfig +5 -0
  2. package/.jshintignore +1 -0
  3. package/.jshintrc +23 -0
  4. package/binding.gyp +56 -0
  5. package/configure +26 -0
  6. package/deps/jq/.gitattributes +2 -0
  7. package/deps/jq/.travis.yml +53 -0
  8. package/deps/jq/AUTHORS +73 -0
  9. package/deps/jq/COPYING +70 -0
  10. package/deps/jq/ChangeLog +1349 -0
  11. package/deps/jq/Makefile.am +198 -0
  12. package/deps/jq/NEWS +88 -0
  13. package/deps/jq/README.md +64 -0
  14. package/deps/jq/builtin.c +1684 -0
  15. package/deps/jq/builtin.h +10 -0
  16. package/deps/jq/bytecode.c +161 -0
  17. package/deps/jq/bytecode.h +92 -0
  18. package/deps/jq/compile-ios.sh +102 -0
  19. package/deps/jq/compile.c +1210 -0
  20. package/deps/jq/compile.h +101 -0
  21. package/deps/jq/config/m4/check-math-func.m4 +4 -0
  22. package/deps/jq/config/m4/find-func-no-libs.m4 +8 -0
  23. package/deps/jq/config/m4/find-func-no-libs2.m4 +62 -0
  24. package/deps/jq/config/m4/find-func.m4 +9 -0
  25. package/deps/jq/config/m4/misc.m4 +3 -0
  26. package/deps/jq/configure.ac +221 -0
  27. package/deps/jq/docs/Gemfile +7 -0
  28. package/deps/jq/docs/Gemfile.lock +63 -0
  29. package/deps/jq/docs/README.md +25 -0
  30. package/deps/jq/docs/Rakefile +145 -0
  31. package/deps/jq/docs/content/1.tutorial/default.yml +327 -0
  32. package/deps/jq/docs/content/2.download/default.yml +117 -0
  33. package/deps/jq/docs/content/3.manual/manual.yml +2878 -0
  34. package/deps/jq/docs/content/3.manual/v1.3/manual.yml +1270 -0
  35. package/deps/jq/docs/content/3.manual/v1.4/manual.yml +1672 -0
  36. package/deps/jq/docs/content/index/index.yml +51 -0
  37. package/deps/jq/docs/default_manpage.md +22 -0
  38. package/deps/jq/docs/public/.htaccess +28 -0
  39. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.css +1058 -0
  40. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.min.css +9 -0
  41. package/deps/jq/docs/public/bootstrap/css/bootstrap.css +5224 -0
  42. package/deps/jq/docs/public/bootstrap/css/bootstrap.min.css +9 -0
  43. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
  44. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings.png +0 -0
  45. package/deps/jq/docs/public/bootstrap/js/bootstrap.js +2027 -0
  46. package/deps/jq/docs/public/bootstrap/js/bootstrap.min.js +6 -0
  47. package/deps/jq/docs/public/css/base.scss +99 -0
  48. package/deps/jq/docs/public/jq.png +0 -0
  49. package/deps/jq/docs/public/robots.txt +2 -0
  50. package/deps/jq/docs/site.yml +18 -0
  51. package/deps/jq/docs/templates/default.liquid +34 -0
  52. package/deps/jq/docs/templates/index.liquid +60 -0
  53. package/deps/jq/docs/templates/manual.liquid +122 -0
  54. package/deps/jq/docs/templates/shared/_footer.liquid +5 -0
  55. package/deps/jq/docs/templates/shared/_head.liquid +12 -0
  56. package/deps/jq/docs/templates/shared/_header.liquid +26 -0
  57. package/deps/jq/exec_stack.h +112 -0
  58. package/deps/jq/execute.c +1155 -0
  59. package/deps/jq/inject_errors.c +112 -0
  60. package/deps/jq/jq.1.default +39 -0
  61. package/deps/jq/jq.1.prebuilt +3075 -0
  62. package/deps/jq/jq.h +60 -0
  63. package/deps/jq/jq.spec +70 -0
  64. package/deps/jq/jq_parser.h +9 -0
  65. package/deps/jq/jq_test.c +346 -0
  66. package/deps/jq/jv.c +1333 -0
  67. package/deps/jq/jv.h +240 -0
  68. package/deps/jq/jv_alloc.c +179 -0
  69. package/deps/jq/jv_alloc.h +27 -0
  70. package/deps/jq/jv_aux.c +619 -0
  71. package/deps/jq/jv_dtoa.c +4275 -0
  72. package/deps/jq/jv_dtoa.h +22 -0
  73. package/deps/jq/jv_file.c +49 -0
  74. package/deps/jq/jv_parse.c +852 -0
  75. package/deps/jq/jv_print.c +348 -0
  76. package/deps/jq/jv_unicode.c +96 -0
  77. package/deps/jq/jv_unicode.h +11 -0
  78. package/deps/jq/jv_utf8_tables.h +37 -0
  79. package/deps/jq/lexer.c +2442 -0
  80. package/deps/jq/lexer.h +362 -0
  81. package/deps/jq/lexer.l +184 -0
  82. package/deps/jq/libm.h +160 -0
  83. package/deps/jq/linker.c +393 -0
  84. package/deps/jq/linker.h +7 -0
  85. package/deps/jq/locfile.c +91 -0
  86. package/deps/jq/locfile.h +29 -0
  87. package/deps/jq/m4/ax_compare_version.m4 +177 -0
  88. package/deps/jq/m4/ax_prog_bison_version.m4 +68 -0
  89. package/deps/jq/main.c +566 -0
  90. package/deps/jq/opcode_list.h +44 -0
  91. package/deps/jq/parser.c +3914 -0
  92. package/deps/jq/parser.h +193 -0
  93. package/deps/jq/parser.y +923 -0
  94. package/deps/jq/scripts/crosscompile +42 -0
  95. package/deps/jq/scripts/gen_utf8_tables.py +32 -0
  96. package/deps/jq/scripts/version +5 -0
  97. package/deps/jq/setup.sh +33 -0
  98. package/deps/jq/tests/jq.test +1235 -0
  99. package/deps/jq/tests/jqtest +5 -0
  100. package/deps/jq/tests/mantest +7 -0
  101. package/deps/jq/tests/modules/.jq +5 -0
  102. package/deps/jq/tests/modules/a.jq +2 -0
  103. package/deps/jq/tests/modules/b/b.jq +2 -0
  104. package/deps/jq/tests/modules/c/c.jq +16 -0
  105. package/deps/jq/tests/modules/c/d.jq +1 -0
  106. package/deps/jq/tests/modules/data.json +4 -0
  107. package/deps/jq/tests/modules/lib/jq/e/e.jq +1 -0
  108. package/deps/jq/tests/modules/lib/jq/f.jq +1 -0
  109. package/deps/jq/tests/modules/syntaxerror/syntaxerror.jq +1 -0
  110. package/deps/jq/tests/modules/test_bind_order.jq +4 -0
  111. package/deps/jq/tests/modules/test_bind_order0.jq +1 -0
  112. package/deps/jq/tests/modules/test_bind_order1.jq +2 -0
  113. package/deps/jq/tests/modules/test_bind_order2.jq +2 -0
  114. package/deps/jq/tests/onig.supp +21 -0
  115. package/deps/jq/tests/onig.test +85 -0
  116. package/deps/jq/tests/onigtest +5 -0
  117. package/deps/jq/tests/setup +36 -0
  118. package/deps/jq/tests/shtest +205 -0
  119. package/deps/jq/tests/torture/input0.json +7 -0
  120. package/deps/jq/util.c +462 -0
  121. package/deps/jq/util.h +64 -0
  122. package/deps/jq.gyp +35 -0
  123. package/index.d.ts +3 -0
  124. package/jest.config.js +10 -0
  125. package/lib/index.js +14 -0
  126. package/package.json +48 -0
  127. package/reports/jest-port-api.xml +35 -0
  128. package/src/binding.cc +177 -0
  129. package/src/binding.h +13 -0
  130. package/test/santiy.test.js +122 -0
  131. package/util/configure.js +27 -0
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ . "${0%/*}/setup"
4
+
5
+ $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/jq.test
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ . "${0%/*}/setup"
4
+
5
+ # We set PAGER because there's a mantest for `env` that uses it.
6
+ (cd $JQBASEDIR/docs && rake mantests) |
7
+ env PAGER=less $VALGRIND $Q $JQ -L "$mods" --run-tests
@@ -0,0 +1,5 @@
1
+ def foo: "baz";
2
+ def f: "wat";
3
+ def f: "foo";
4
+ def g: "bar";
5
+ def fg: f+g;
@@ -0,0 +1,2 @@
1
+ module {version:1.7};
2
+ def a: "a";
@@ -0,0 +1,2 @@
1
+ def a: "b";
2
+ def b: "c";
@@ -0,0 +1,16 @@
1
+ module {whatever:null};
2
+ import "a" as foo;
3
+ import "d" as d {search:"./"};
4
+ import "d" as d2{search:"./"};
5
+ import "e" as e {search:"./../lib/jq"};
6
+ import "f" as f {search:"./../lib/jq"};
7
+ import "data" as $d;
8
+ def a: 0;
9
+ def c:
10
+ if $d::d[0] != {this:"is a test",that:"is too"} then error("data import is busted")
11
+ elif d2::meh != d::meh then error("import twice doesn't work")
12
+ elif foo::a != "a" then error("foo::a didn't work as expected")
13
+ elif d::meh != "meh" then error("d::meh didn't work as expected")
14
+ elif e::bah != "bah" then error("e::bah didn't work as expected")
15
+ elif f::f != "f is here" then error("f::f didn't work as expected")
16
+ else foo::a + "c" + d::meh + e::bah end;
@@ -0,0 +1 @@
1
+ def meh: "meh";
@@ -0,0 +1,4 @@
1
+ {
2
+ "this": "is a test",
3
+ "that": "is too"
4
+ }
@@ -0,0 +1 @@
1
+ def bah: "bah";
@@ -0,0 +1 @@
1
+ def f: "f is here";
@@ -0,0 +1,4 @@
1
+ import "test_bind_order0" as t;
2
+ import "test_bind_order1" as t;
3
+ import "test_bind_order2" as t;
4
+ def check: if [t::sym0,t::sym1,t::sym2] == [0,1,2] then true else false end;
@@ -0,0 +1 @@
1
+ def sym0: 0;
@@ -0,0 +1,2 @@
1
+ def sym0: 1;
2
+ def sym1: 1;
@@ -0,0 +1,2 @@
1
+ def sym1: 2;
2
+ def sym2: 2;
@@ -0,0 +1,21 @@
1
+ {
2
+ onig node recycling
3
+ Memcheck:Leak
4
+ ...
5
+ fun:onig_parse_make_tree
6
+ ...
7
+ }
8
+ {
9
+ onig unicode case insensitivity 1
10
+ Memcheck:Leak
11
+ ...
12
+ fun:setup_tree
13
+ ...
14
+ }
15
+ {
16
+ onig unicode case insensitivity 2
17
+ Memcheck:Leak
18
+ ...
19
+ fun:onig*unicode*
20
+ ...
21
+ }
@@ -0,0 +1,85 @@
1
+ # match builtin
2
+ [match("( )*"; "g")]
3
+ "abc"
4
+ [{"offset":0, "length":0, "string":"", "captures":[]},{"offset":1, "length":0, "string":"", "captures":[]},{"offset":2, "length":0, "string":"", "captures":[]}]
5
+
6
+ [match("( )*"; "gn")]
7
+ "abc"
8
+ []
9
+
10
+ [match("a"; "gi")]
11
+ "āáàä"
12
+ []
13
+
14
+ [match(["(bar)"])]
15
+ "foo bar"
16
+ [{"offset": 4, "length": 3, "string": "bar", "captures":[{"offset": 4, "length": 3, "string": "bar", "name": null}]}]
17
+
18
+ # offsets account for combining codepoints and multi-byte UTF-8
19
+ [match("bar")]
20
+ "ā bar with a combining codepoint U+0304"
21
+ [{"offset": 3, "length": 3, "string": "bar", "captures":[]}]
22
+
23
+ # matches with combining codepoints still count them in their length
24
+ [match("bār")]
25
+ "a bār"
26
+ [{"offset": 2, "length": 4, "string": "bār", "captures":[]}]
27
+
28
+ [match(".+?\\b")]
29
+ "ā two-codepoint grapheme"
30
+ [{"offset": 0, "length": 2, "string": "ā", "captures":[]}]
31
+
32
+ [match(["foo (?<bar123>bar)? foo", "ig"])]
33
+ "foo bar foo foo foo"
34
+ [{"offset": 0, "length": 11, "string": "foo bar foo", "captures":[{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]},{"offset":12, "length": 8, "string": "foo foo", "captures":[{"offset": -1, "length": 0, "string": null, "name": "bar123"}]}]
35
+
36
+ #test builtin
37
+ [test("( )*"; "gn")]
38
+ "abc"
39
+ [false]
40
+
41
+ [test("ā")]
42
+ "ā"
43
+ [true]
44
+
45
+ capture("(?<a>[a-z]+)-(?<n>[0-9]+)")
46
+ "xyzzy-14"
47
+ {"a":"xyzzy","n":"14"}
48
+
49
+
50
+ # jq-coded utilities built on match:
51
+ #
52
+ # The second element in these tests' inputs tests the case where the
53
+ # fromstring matches both the head and tail of the string
54
+ [.[] | sub(", "; ":")]
55
+ ["a,b, c, d, e,f", ", a,b, c, d, e,f, "]
56
+ ["a,b:c, d, e,f",":a,b, c, d, e,f, "]
57
+
58
+ sub("^(?<head>.)"; "Head=\(.head) Tail=")
59
+ "abcdef"
60
+ "Head=a Tail=bcdef"
61
+
62
+ [.[] | gsub(", "; ":")]
63
+ ["a,b, c, d, e,f",", a,b, c, d, e,f, "]
64
+ ["a,b:c:d:e,f",":a,b:c:d:e,f:"]
65
+
66
+ gsub("(?<d>\\d)"; ":\(.d);")
67
+ "a1b2"
68
+ "a:1;b:2;"
69
+
70
+ [.[] | scan(", ")]
71
+ ["a,b, c, d, e,f",", a,b, c, d, e,f, "]
72
+ [", ",", ",", ",", ",", ",", ",", ",", "]
73
+
74
+ [.[]|[[sub(", *";":")], [gsub(", *";":")], [scan(", *")]]]
75
+ ["a,b, c, d, e,f",", a,b, c, d, e,f, "]
76
+ [[["a:b, c, d, e,f"],["a:b:c:d:e:f"],[",",", ",", ",", ",","]],[[":a,b, c, d, e,f, "],[":a:b:c:d:e:f:"],[", ",",",", ",", ",", ",",",", "]]]
77
+
78
+ [.[]|[[sub(", +";":")], [gsub(", +";":")], [scan(", +")]]]
79
+ ["a,b, c, d, e,f",", a,b, c, d, e,f, "]
80
+ [[["a,b:c, d, e,f"],["a,b:c:d:e,f"],[", ",", ",", "]],[[":a,b, c, d, e,f, "],[":a,b:c:d:e,f:"],[", ",", ",", ",", ",", "]]]
81
+
82
+ # reference to named captures
83
+ gsub("(?<x>.)[^a]*"; "+\(.x)-")
84
+ "Abcabc"
85
+ "+A-+a-"
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ . "${0%/*}/setup"
4
+
5
+ $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/onig.test
@@ -0,0 +1,36 @@
1
+ #!/bin/sh
2
+
3
+ # This is meant to be included by each test's shell script driver.
4
+
5
+ set -eu
6
+
7
+ JQTESTDIR=$(cd "$(dirname "$0")" && pwd)
8
+ JQBASEDIR=$JQTESTDIR/..
9
+ JQ=$JQBASEDIR/jq
10
+
11
+ if [ -z "${NO_VALGRIND-}" ] && which valgrind > /dev/null; then
12
+ VALGRIND="valgrind --error-exitcode=1 --leak-check=full \
13
+ --suppressions=$JQTESTDIR/onig.supp"
14
+ Q=-q
15
+ else
16
+ VALGRIND=
17
+ Q=
18
+ fi
19
+
20
+ mods=$JQTESTDIR/modules
21
+
22
+ clean=true
23
+ d=
24
+ clean () {
25
+ if ! $clean; then
26
+ echo "See temp files in $d!"
27
+ elif [ -n "$d" ]; then
28
+ rm -rf "$d"
29
+ fi
30
+ }
31
+ trap clean EXIT
32
+ d=`mktemp -d -t jqXXXXX || true`
33
+ if [ -z "$d" ]; then
34
+ echo "Your OS does not support mktemp(1) -d" 1>&2
35
+ exit 1
36
+ fi
@@ -0,0 +1,205 @@
1
+ #!/bin/sh
2
+
3
+ . "${0%/*}/setup"
4
+
5
+ if [ -f "$JQBASEDIR/.libs/libinject_errors.so" ]; then
6
+ # Do some simple error injection tests to check that we're handling
7
+ # I/O errors correctly.
8
+ (
9
+ libinject=$JQBASEDIR/.libs/libinject_errors.so
10
+ cd $d
11
+ LD_PRELOAD=$libinject $JQ . /dev/null
12
+ touch fail_read
13
+ LD_PRELOAD=$libinject $JQ . fail_read && exit 2
14
+ touch fail_close
15
+ LD_PRELOAD=$libinject $JQ . fail_close && exit 2
16
+ true
17
+ )
18
+ fi
19
+
20
+ printf 'a\0b\nc\0d\ne' > $d/input
21
+ $VALGRIND $Q $JQ -Rse '. == "a\u0000b\nc\u0000d\ne"' $d/input
22
+ $VALGRIND $Q $JQ -Rne '[inputs] == ["a\u0000b", "c\u0000d", "e"]' $d/input
23
+
24
+ ## Test constant folding
25
+
26
+ ## XXX If we add a builtin to list the program's disassembly then we can
27
+ ## move all of these into tests/all.test
28
+
29
+ # String constant folding (addition only)
30
+ n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '"foo"' | wc -l`
31
+ if [ $n -ne 5 ]; then
32
+ echo "Constant expression folding for strings didn't work"
33
+ exit 1
34
+ fi
35
+
36
+ # Numeric constant folding (not all ops yet)
37
+ n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '1+1' | wc -l`
38
+ if [ $n -ne 5 ]; then
39
+ echo "Constant expression folding for strings didn't work"
40
+ exit 1
41
+ fi
42
+ n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '1-1' | wc -l`
43
+ if [ $n -ne 5 ]; then
44
+ echo "Constant expression folding for strings didn't work"
45
+ exit 1
46
+ fi
47
+ n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '2*3' | wc -l`
48
+ if [ $n -ne 5 ]; then
49
+ echo "Constant expression folding for strings didn't work"
50
+ exit 1
51
+ fi
52
+ n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9/3' | wc -l`
53
+ if [ $n -ne 5 ]; then
54
+ echo "Constant expression folding for strings didn't work"
55
+ exit 1
56
+ fi
57
+ n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9==3' | wc -l`
58
+ if [ $n -ne 5 ]; then
59
+ echo "Constant expression folding for strings didn't work"
60
+ exit 1
61
+ fi
62
+ n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9!=3' | wc -l`
63
+ if [ $n -ne 5 ]; then
64
+ echo "Constant expression folding for strings didn't work"
65
+ exit 1
66
+ fi
67
+ n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9<=3' | wc -l`
68
+ if [ $n -ne 5 ]; then
69
+ echo "Constant expression folding for strings didn't work"
70
+ exit 1
71
+ fi
72
+ n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9>=3' | wc -l`
73
+ if [ $n -ne 5 ]; then
74
+ echo "Constant expression folding for strings didn't work"
75
+ exit 1
76
+ fi
77
+
78
+ ## Test JSON sequence support
79
+
80
+ cat > $d/expected <<EOF
81
+ ignoring parse error: Truncated value at line 2, column 5
82
+ ignoring parse error: Truncated value at line 2, column 25
83
+ ignoring parse error: Truncated value at line 2, column 41
84
+ EOF
85
+ printf '1\0362 3\n[0,1\036[4,5]true"ab"{"c":4\036{}{"d":5,"e":6"\036false\n'|$VALGRIND $Q $JQ -ces --seq '. == [2,3,[4,5],true,"ab",{},false]' > /dev/null 2> $d/out
86
+ cmp $d/out $d/expected
87
+
88
+ cat > $d/expected <<EOF
89
+ ignoring parse error: Truncated value at line 2, column 5
90
+ ignoring parse error: Truncated value at line 2, column 25
91
+ ignoring parse error: Truncated value at line 3, column 1
92
+ EOF
93
+ printf '1\0362 3\n[0,1\036[4,5]true"ab"{"c":4\036{}{"d":5,"e":6"false\n\036null'|$VALGRIND $Q $JQ -ces --seq '. == [2,3,[4,5],true,"ab",{},null]' > /dev/null 2> $d/out
94
+ cmp $d/out $d/expected
95
+
96
+ # Note that here jq sees no inputs at all but it still succeeds because
97
+ # --seq ignores parse errors
98
+ cat > $d/expected <<EOF
99
+ ignoring parse error: Unfinished abandoned text at EOF at line 1, column 4
100
+ EOF
101
+ printf '"foo' | $JQ -ce --seq . > $d/out 2>&1
102
+ cmp $d/out $d/expected
103
+
104
+ # Numeric values truncated by EOF are ignored
105
+ cat > $d/expected <<EOF
106
+ ignoring parse error: Unfinished abandoned text at EOF at line 1, column 1
107
+ EOF
108
+ printf '1' | $JQ -ce --seq . > $d/out 2>&1
109
+ cmp $d/out $d/expected
110
+
111
+ cat > $d/expected <<EOF
112
+ EOF
113
+ printf '1\n' | $JQ -cen --seq '[inputs] == []' >/dev/null 2> $d/out
114
+ cmp $d/out $d/expected
115
+
116
+ ## Test streaming parser
117
+
118
+ ## If we add an option to stream to the `import ... as $symbol;` directive
119
+ ## then we can move these tests into tests/all.test.
120
+ $VALGRIND $Q $JQ -c '. as $d|path(..) as $p|$d|getpath($p)|scalars_or_empty|[$p,.]' < "$JQTESTDIR/torture/input0.json" > $d/out0
121
+ $VALGRIND $Q $JQ --stream -c '.|select(length==2)' < "$JQTESTDIR/torture/input0.json" > $d/out1
122
+ diff $d/out0 $d/out1
123
+
124
+ ## XXX This test can be moved to tests/all.test _now_
125
+ clean=false
126
+ if which seq > /dev/null 2>&1; then
127
+ # XXX We should try every prefix of input0.json, but that makes this
128
+ # test very, very slow when run with valgrind, and the whole point
129
+ # is to run it with valgrind.
130
+ #
131
+ #len=`wc -c < "$JQTESTDIR/torture/input0.json"`
132
+ if [ -z "$VALGRIND" ]; then
133
+ start=1
134
+ end=`wc -c < "$JQTESTDIR/torture/input0.json"`
135
+ else
136
+ start=120
137
+ end=151
138
+ fi
139
+ for i in `seq $start $end`; do
140
+ dd "if=tests/torture/input0.json" bs=$i count=1 2>/dev/null |
141
+ $VALGRIND $JQ -c . > $d/out0 2>$d/err || true
142
+ if [ -n "$VALGRIND" ]; then
143
+ grep '^==[0-9][0-9]*== ERROR SUMMARY: 0 errors' $d/err > /dev/null
144
+ else
145
+ tail -1 $d/err | egrep -i 'assert|abort|core' && false
146
+ fi
147
+
148
+ dd "if=tests/torture/input0.json" bs=$i count=1 2>/dev/null |
149
+ $VALGRIND $JQ -cn --stream 'fromstream(inputs)' > $d/out1 2>$d/err || true
150
+ if [ -n "$VALGRIND" ]; then
151
+ grep '^==[0-9][0-9]*== ERROR SUMMARY: 0 errors' $d/err > /dev/null
152
+ else
153
+ tail -1 $d/err | egrep -i 'assert|abort|core' && false
154
+ fi
155
+
156
+ diff $d/out0 $d/out1
157
+ done
158
+ else
159
+ echo "Not doing torture tests"
160
+ fi
161
+
162
+ ## Fuzz parser
163
+
164
+ ## XXX With a `urandom` builtin we could move this test into tests/all.test
165
+ clean=false
166
+ if dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null; then
167
+ # Have a /dev/urandom, good
168
+ $VALGRIND $Q $JQ --seq . $d/rand >/dev/null 2>&1
169
+ $VALGRIND $Q $JQ --seq --stream . $d/rand >/dev/null 2>&1
170
+ dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null
171
+ $VALGRIND $Q $JQ --seq . $d/rand >/dev/null 2>&1
172
+ $VALGRIND $Q $JQ --seq --stream . $d/rand >/dev/null 2>&1
173
+ dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null
174
+ $VALGRIND $Q $JQ --seq . $d/rand >/dev/null 2>&1
175
+ $VALGRIND $Q $JQ --seq --stream . $d/rand >/dev/null 2>&1
176
+ fi
177
+ clean=true
178
+
179
+ ## Test library/module system
180
+
181
+ # Check handling of ~/.jq; these can't move into jq_test.c yet because
182
+ # they depend on $HOME
183
+ if [ "`HOME="$mods" $VALGRIND $Q $JQ -nr fg`" != foobar ]; then
184
+ echo "Bug #479 appears to be back" 1>&2
185
+ exit 1
186
+ fi
187
+
188
+ if [ `HOME="$mods" $VALGRIND $Q $JQ --debug-dump-disasm -n fg | grep '^[a-z]' | wc -l` -gt 3 ]; then
189
+ echo "Binding too many defs into program" 1>&2
190
+ exit 1
191
+ fi
192
+
193
+ cd "$JQBASEDIR" # so that relative library paths are guaranteed correct
194
+ if ! $VALGRIND $Q $JQ -L ./tests/modules -ne 'import "test_bind_order" as check; check::check==true'; then
195
+ echo "Issue #817 regression?" 1>&2
196
+ exit 1
197
+ fi
198
+
199
+ cd "$JQBASEDIR"
200
+ if ! $VALGRIND $Q $JQ -L tests/modules -ne 'import "test_bind_order" as check; check::check==true'; then
201
+ echo "Issue #817 regression?" 1>&2
202
+ exit 1
203
+ fi
204
+
205
+ exit 0
@@ -0,0 +1,7 @@
1
+ 0 12 true false null [] {} [{}] [[]]
2
+ [0,01,[12,22,[34,[45,56],7]],[]]
3
+ {"a":[1]}
4
+ {"a":[{}]}
5
+ {"a":[{},[],[[]]]}
6
+ {"a":[{"b":[]}]}
7
+ {"a":[{"b":[]},{},[2]]}