summaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)Author
2018-08-17Fix destructuring alternationfix-destructuring-alternationWilliam Langford
Attempting to use the existing FORK_OPT opcode resulted in difficulty knowing when to pop an error message off the stack and when not to. This commit makes DESTRUCTURE_ALT a real opcode that is identical to FORK_OPT, except for never pushing the error message onto the stack when continuing from an error backtrack. Some small changes were necessary to the DUP/POP behavior surrounding destructuring to accomodate this.
2018-02-20Change backticks to the more legible $()David Fetter
2017-12-11Revert "reduce: handle empty updates (fix #1313)"Nicolas Williams
This reverts commit e24af3c78e78a3aab05a2800d825d56f1d842b1b. While the semantics are desirable, there is no way to implement them efficiently. The reason is that in order to handle backtracking (empty) from the state update expression, we have to retain a reference to the reduction state value in order to restore it upon backtracking. Retaining a reference to the reduction state kills performance by causing lots of additional memory allocations and garbage because the input to the update expression will always have at least two references, thus no changes to it can be done in-place, and all changes end up being CoW changes. Avoiding this is the very reason for the LOADVN instruction (leaving `null` in the variable loaded from).
2017-12-04Fix hang for slurped inputs with trailing newlineWilliam Langford
2017-12-04Fix #1534William Langford
2017-11-29Actually fix the strptime testsmacos-strptimeWilliam Langford
This has been a complicated issue to fix for a number of reasons. The core of it is that the behavior is different between different versions of macOS, some of which set possible-but-incorrect values. This commit addresses the issue by always using our computation for tm_wday and tm_yday on macOS. As a side-effect, strptime format strings that specify %u and %j will no longer work on macOS.
2017-11-27Fix strptime tests on macOS 10.12William Langford
Dates in 1900 are before the Unix epoch. We shouldn't make any promises about how well they are supported, especially given that our time support is a thin wrapper over the libc functions. This changes the test to use dates after the epoch, which should fit within both a signed and an unsigned 32-bit time_t.
2017-11-23Fix leak on error in strptimeNicolas Williams
2017-05-21Deal with strptime() on OS X and *BSD (fix #1415)Nicolas Williams
strptime() on OS X and *BSDs (reputedly) does not set tm_wday and tm_yday unless corresponding %U and %j format specifiers were used. That can be... surprising when one parsed year, month, and day anyways. Glibc's strptime() conveniently sets tm_wday and tm_yday in those cases, but OS X's does not, ignoring them completely. This commit makes jq compute those where possible, though the day of week computation may be wrong for dates before 1900-03-01 or after 2099-12-31.
2017-04-29Add JQ_COLORS env var for color config (fix #1252)Nico Williams
2017-04-15def isempty(g) # Testing 'isempty(empty)' at line number 1364pkoppstein
2017-03-26Allow . as {$a:$b} destructuringNicolas Williams
2017-03-26Add more destructuring testsNicolas Williams
2017-03-26Fix a tripped assertion when generating reducesWilliam Langford
A noop body, while useless, should still compile successfully
2017-03-15Conditional exprs are not path exprs (fix #1368)Nicolas Williams
The conditional expression in if-then-elif-else-end cannot contribute to path expressions because it doesn't change the input to any of the then/ elif/else expressions. These must be generated via gen_subexp(). See also #1366.
2017-03-01Fix off-by-one bug in #1108 fixNicolas Williams
2017-03-01Array slice overflows (fix #1108)Nicolas Williams
2017-02-28getpath/1 should be a path expression (fix #1358)Nicolas Williams
It needs to be possible to do something like getpath($paths[]) += 1 meaning: increment all the paths in . that are listed in $paths[]. In order to do this getpath() needs to update the jq->path and jq->value_at_path as necessary.
2017-02-26Add `halt`, `halt_error` builtins (fix #386)Nicolas Williams
2017-02-26Fix error message for undefined varsNicolas Williams
2017-02-25Make test/shtest test of constant folding robustNicolas Williams
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-21Allow var bindings in path expressions (#1347)Nicolas Williams
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-12Add @base64d for decoding base64 #47Shaun Guth
2017-01-30Add SQL-style operators (#1322)Nicolas Williams
2017-01-30Make first(g) more efficient: extract only 1 valueNicolas Williams
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-30reduce: handle empty updates (fix #1313)Nicolas Williams
2017-01-27Handle cut-off UTF-8 sequences when reading filesWilliam Langford
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.
2016-01-18Always test sort_by/group_by post-#1082Nicolas Williams
2016-01-17Make it possible to run tests with set -xNicolas Williams
One can now run: make TRACE_TESTS=1 check to get detailed output
2016-01-17Enable more tests on Windows; move sort_by testsNicolas Williams
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.
2015-12-14Make it easier to use jq with shebangs (fix #1044)Nicolas Williams
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-09Two sub bugs fixed; two new gsub tests have been added.pkoppstein
./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-10-25Support numbers and boolean in join (fix #930)David Tolnay
2015-10-24mktemp needs 6 or more X's (fix #1000)David Tolnay
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-17If-then-else documentation for forking conditional (fix #942)David Tolnay
2015-10-17Support lowercase name in from_entries (fix #990)David Tolnay
2015-09-24Support NaN in path expressions (fix #962)David Tolnay
2015-09-22EOF after newline in string mishandled (fix #951)Nicolas Williams
2015-09-21Delete negative indices in array (fix #954)David Tolnay
2015-09-21Fix assert fail if object literal key is not a string (fix #953)David Tolnay
2015-09-13utf8bytelength: count UTF8 string bytelengthJoel Nothman
[Builtin name changed, and it only works on string inputs. -Nico]
2015-08-22Fix decoding of UTF-8 sequence length (fix #922)David Tolnay
2015-08-16Fix assert fail when delpaths is given non-array (fix #901)David Tolnay
2015-08-13Fix memory leak in non-constant module declarationDavid Tolnay
2015-08-13Fix assert fail on invalid import path (fix #899)David Tolnay
2015-08-13Fix assert fail on non-object import metadata (fix #900)David Tolnay
2015-08-13Test main.c fix for #817Nicolas Williams
2015-08-11Fix #896, double-free in `setpath`Nicolas Williams
2015-08-06Fix range(value;stream) (fix #886)David Tolnay
2015-07-28OS X's mktemp -d requires template (fix #876)Nicolas Williams