Nicolas Williams
8ea21a54ad
Add halt, halt_error builtins ( fix #386 )
2017-02-26 16:34:56 -06:00
Nicolas Williams
1a8a0ae0f5
Fix error message for undefined vars
2017-02-26 00:37:28 -06:00
Nicolas Williams
8619c6e060
Make test/shtest test of constant folding robust
...
Rather than testing that a constant expression produces so many
instructions, test that a variety of of such expressions produce the
same number of instructions. This will make future changes in the
compiler less likely to break this test.
2017-02-25 19:13:28 -06:00
Nicolas Williams
8cde328007
Allow var bindings in path expressions ( #1347 )
...
The expression in a variable binding is not and must not be seen as
being part of a path expression in which the variable binding appears.
2017-02-21 18:11:35 -06:00
Shaun Guth
e0b784ac6d
Add @base64d for decoding base64 #47
2017-02-12 16:03:59 -05:00
Nicolas Williams
7bdf3a39ad
Add SQL-style operators ( #1322 )
2017-01-30 14:11:05 -06:00
Nicolas Williams
396543191c
Make first(g) more efficient: extract only 1 value
...
first(g) was extracting two values, which, if g is slow, made first(g)
slow. And if the second extraction were to throw an error, then
first(g) would throw that error, which is clearly not the right thing to
do. Besides that, first(g) was allocating garbage, which it no longer
does.
2017-01-30 14:11:05 -06:00
Nicolas Williams
e24af3c78e
reduce: handle empty updates ( fix #1313 )
2017-01-30 14:11:05 -06:00
William Langford
e84d17196c
Handle cut-off UTF-8 sequences when reading files
...
Read additional bytes from the file to complete the UTF-8 sequence so the bytes
in it don't get converted to U+FFFD replacement characters.
2017-01-27 21:04:26 -05:00
Nicolas Williams
6c635998f8
Always test sort_by/group_by post-#1082
2016-01-18 12:17:58 -06:00
Nicolas Williams
c514368f98
Make it possible to run tests with set -x
...
One can now run:
make TRACE_TESTS=1 check
to get detailed output
2016-01-17 12:45:01 -06:00
Nicolas Williams
062f86a625
Enable more tests on Windows; move sort_by tests
...
Use %%FAIL IGNORE MSG for error messages that differ on Windows, and
move the sort_by/group_by tests that fail qhen qsort() is not stable.
Now only tests/sorttest and tests/shtest are disabled on Windows.
2016-01-17 12:45:01 -06:00
Nicolas Williams
8f6f28c8d3
Make it easier to use jq with shebangs ( fix #1044 )
...
Allow a continuation on a comment immediately after a shebang to make
this traditional hack possible:
#!/bin/sh
# this next line is ignored by jq \
exec jq -f "$0" "$@"
# jq code follows
But continue only on the first line following a shebang, and only if
it's a comment.
2015-12-14 22:08:17 -08:00
pkoppstein
ad8d1a8cc8
Two sub bugs fixed; two new gsub tests have been added.
...
./jq --run-tests < tests/onig.test
has been run successfully:
...
Testing 'gsub("a";"b")' at line number 70
Testing 'gsub( "(.*)"; ""; "x")' at line number 74
...
22 of 22 tests passed (0 malformed)
2015-12-09 15:28:01 -06:00
David Tolnay
e17ccf2297
Support numbers and boolean in join ( fix #930 )
2015-10-25 12:40:15 -07:00
David Tolnay
b7a219a91d
mktemp needs 6 or more X's ( fix #1000 )
...
mktemp(1) isn't posix specified, but it's reasonable to use
mktemp(3) to implement it which requires 6 trailing X's in
the format
Thanks @sthen
2015-10-24 11:21:18 -07:00
David Tolnay
6c31850e86
If-then-else documentation for forking conditional ( fix #942 )
2015-10-17 21:15:24 -07:00
David Tolnay
c8dc164566
Support lowercase name in from_entries ( fix #990 )
2015-10-17 20:50:40 -07:00
David Tolnay
4490d9d1f6
Support NaN in path expressions ( fix #962 )
2015-09-24 10:33:34 -07:00
Nicolas Williams
c4524da3e0
EOF after newline in string mishandled ( fix #951 )
2015-09-22 20:11:54 -07:00
David Tolnay
58f082d74f
Delete negative indices in array ( fix #954 )
2015-09-21 20:33:06 -07:00
David Tolnay
154d0ee4a8
Fix assert fail if object literal key is not a string ( fix #953 )
2015-09-21 12:47:06 -07:00
Joel Nothman
83e8ec587f
utf8bytelength: count UTF8 string bytelength
...
[Builtin name changed, and it only works on string inputs. -Nico]
2015-09-13 01:01:24 -05:00
David Tolnay
6c3934de15
Fix decoding of UTF-8 sequence length ( fix #922 )
2015-08-22 12:31:36 -07:00
David Tolnay
b8f71d3659
Fix assert fail when delpaths is given non-array ( fix #901 )
2015-08-16 19:44:16 -07:00
David Tolnay
58a053d7de
Fix memory leak in non-constant module declaration
2015-08-13 21:42:35 -07:00
David Tolnay
7b5c6a9224
Fix assert fail on invalid import path ( fix #899 )
2015-08-13 21:42:35 -07:00
David Tolnay
5479d7f2dc
Fix assert fail on non-object import metadata ( fix #900 )
2015-08-13 21:42:35 -07:00
Nicolas Williams
b119853aef
Test main.c fix for #817
2015-08-13 09:08:37 -07:00
Nicolas Williams
9a3f802d20
Fix #896 , double-free in setpath
2015-08-11 17:46:15 -05:00
David Tolnay
a47b32999b
Fix range(value;stream) ( fix #886 )
2015-08-06 23:05:03 -07:00
Nicolas Williams
b5edbf7ffa
OS X's mktemp -d requires template ( fix #876 )
2015-07-28 00:28:54 -05:00
Santiago Lapresta
3d49fc59dd
Implement flatten/0 in terms of flatten/1
2015-07-24 21:55:43 -07:00
David Tolnay
16e8d0b1ab
detect invalid path expression ( fix #862 )
2015-07-24 20:23:07 -07:00
David Tolnay
66ef8e2c24
Resolve shift/reduce conflict of 'def' vs '|'
...
This was an important conflict. In the following expression:
def a: 0; . | a
Bison needs to decide between these two equally valid
parses:
(def a: 0; .) | a
def a: 0; (. | a)
For jq we want the second one, because the first results in
"a/0 is not defined". In the current parser the first parse
is a reduce and the second parse is a shift. Since Bison
prefers to shift in shift/reduce conflicts, we accidentally
got the correct behavior.
This commit adds a precedence level FUNCDEF which is lower
precedence than '|', meaning we explicitly choose the
correct parse.
Of course many unit tests already cover this case, but I
added one specifically for it.
2015-07-19 09:42:01 -07:00
Nicolas Williams
579518c78d
Use include for import into namespace
2015-07-10 10:19:33 -05:00
David Tolnay
6e27de4f74
strftime wrong day-of-week ( fix #838 )
2015-07-01 20:37:16 -07:00
Nicolas Williams
fd4f4f2087
Make --run-tests' jv_test() quiet
2015-06-28 13:39:32 -05:00
Nicolas Williams
32c4759e6b
Add more basic number tests
2015-06-27 23:15:16 -05:00
David Tolnay
d7e35101c5
add configure option to run tests without valgrind
2015-06-27 11:24:53 -07:00
Nicolas Williams
1defaa7b00
Fix braino in merging the previous commit
...
There's a mantest that shows how to use `env`. Well, we need to set the
env var as expected then, else it will fail.
2015-06-27 13:00:41 -05:00
Nicolas Williams
aaf305868c
Restore import into caller's namespace
2015-06-26 23:40:37 -05:00
Nicolas Williams
a011ac6392
Use set -u in tests/setup
2015-06-26 23:36:34 -05:00
Nicolas Williams
25d47ca08e
Add streaming utilities ( fix #827 )
2015-06-26 20:45:06 -05:00
Nicolas Williams
5108a451ca
Alternative implementation of tovalues
2015-06-26 20:17:02 -05:00
David Tolnay
1146b8b84a
separate jq, oniguruma, sh, and man tests
2015-06-18 23:55:43 -05:00
Nicolas Williams
b9c2a326ba
Fix #814 : raise on div-0, add inf isinf nan isnan
2015-06-17 19:58:55 -05:00
Nicolas Williams
4ef04e5b5c
Sequence parser: wait for RS on startup ( fix #687 )
...
Per-RFC7464.
2015-06-17 11:24:34 -05:00
David Tolnay
d3343d5113
array and object destructuring ( fix #533 )
...
`. as [$i, $j, $k] | ...`
`. as {a: $i, b: $j} | ...`
`. as [[[$i]], {a: $j}] | ...`
`foreach . as [$i, $j, $k] (...)`
`reduce . as {a: $i, b: $j} (...)`
2015-06-09 17:29:48 -05:00
Nicolas Williams
11f084f9a7
Keywords should be OK as object keys ( fix #794 )
...
With this change it's now OK to use keywords as object keys like so:
{if:0}
2015-05-25 13:34:07 -05:00