summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix iterration problem for non decimal stringTomas Halman2022-05-261-0/+5
| | | | | | | | | When the string transformation to number failed, all following transformation failed too. This happend because status in decNumberFromString function is updated just in error case. Reusing the DEC_CONTEXT that failed before results into error even if the string is valid number.
* Rework pipenv requirement to be more relaxedWilliam Langford2020-03-022-2/+844
| | | | | | Keep a cached copy of the man tests that we can use when no manpage changes are made. This allows automated systems that might not have easy access to a pipenv to build and run tests.
* fix typosAlanscut2020-01-141-2/+2
|
* Fix nesting try/catch inside internal errorsWilliam Langford2019-11-211-0/+4
|
* Save literal value of the parsed number to preserve it for the outputLeonid S. Usov2019-10-223-1/+55
| | | | | | | | | | | | | | | | | Extend jv_number to use decNumber for storing number literals. Any math operations on the numbers will truncate them to double precision. Comparisons when both numbers are literal numbers will compare them without truncation. Delay conversion of numbers to doubles until a math operation is performed, to preserve precision. A literal jv_number will only need conversion to double once, and will reuse the resultant double on subsequent conversions. Outputting literal jv_numbers preserves the original precision. Add strong pthread requirement to manage contexts/allocations for converting numbers between their decNumber, string, and double formats.
* Fix tests/jq.test for c72ed135Nicolas Williams2019-03-251-8/+8
|
* Fix tests/shtest broken by 2b4d51fNicolas Williams2019-03-251-10/+10
|
* Allow keywords in more places (fix #1868)Nicolas Williams2019-03-241-0/+11
|
* Restore cfunction arity in builtins/0Muh Muhten2019-02-261-0/+15
| | | | | Count arguments up-front at definition/invocation instead of doing it at bind time, which comes after generating builtins/0 since e843a4f.
* Bind libraries backward for consistent shadowingMuh Muhten2019-02-266-2/+25
|
* Fix regression on ~/.jq being a directoryMuh Muhten2019-02-263-2/+8
|
* Fix alpine buildMuh Muhten2019-02-261-7/+7
|
* Make shtest verbose 2 diag. alpine build failureNicolas Williams2019-02-261-1/+1
| | | | | Temporarily(?) make tests/shtest verbose to help diagnose Travis alpine build failures.
* Remove ruby dependency from mantestsWilliam Langford2019-02-261-1/+1
|
* Simplify and optimize SQLish builtinsMuh Muhten2019-02-261-0/+11
|
* Fix bizarre bsearch/1 behaviour with a stream argumentMuh Muhten2019-02-261-1/+3
|
* Add more tests for any and allMuh Muhten2019-02-261-0/+45
|
* Remove scalars_or_emptyMuh Muhten2019-02-261-1/+1
|
* Ensure limit(0; ...) is emptyMuh Muhten2019-02-211-0/+8
|
* Support "if" without "else" clauseChance Zibolski2019-02-201-0/+13
| | | | | | | | | | | | | | | | | | | | | Defaults the else clause to the identity filter "." if an else clause is missing. The following two jq programs are considered equivalent: ``` if .foo then .foo = "bar" else . end ``` ``` if .foo then .foo = "bar" end ```
* Bind data imports properly when already resolvedMuh Muhten2019-02-201-0/+4
|
* Fix infinite loop in index("") (fix #1815)Nicolas Williams2019-02-081-0/+5
|
* Add tests for built-in function `contains`David Haguenauer2019-01-221-3/+20
|
* `contains` should handle embedded NULs (fix #1732)Nicolas Williams2019-01-181-0/+5
|
* fix --exit-code issues #1142 and #1139Ryoichi KATO2018-12-181-2/+23
| | | | | | * Set default error code to -4 in main(), Fixes #1142 * fix --exit-code with more than one object in input, Fixes #1139 - Return code 1 or 4 based on last output, not last input.
* Fix destructuring alternationfix-destructuring-alternationWilliam Langford2018-08-171-0/+101
| | | | | | | | | | | 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.
* Change backticks to the more legible $()David Fetter2018-02-203-20/+20
|
* Revert "reduce: handle empty updates (fix #1313)"Nicolas Williams2017-12-111-5/+0
| | | | | | | | | | | | | | | | | 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).
* Fix hang for slurped inputs with trailing newlineWilliam Langford2017-12-041-0/+2
|
* Fix #1534William Langford2017-12-041-0/+6
|
* Actually fix the strptime testsmacos-strptimeWilliam Langford2017-11-291-2/+3
| | | | | | | | | | 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.
* Fix strptime tests on macOS 10.12William Langford2017-11-271-2/+2
| | | | | | | | | 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.
* Fix leak on error in strptimeNicolas Williams2017-11-231-0/+1
|
* Deal with strptime() on OS X and *BSD (fix #1415)Nicolas Williams2017-05-211-1/+6
| | | | | | | | | | | | 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.
* Add JQ_COLORS env var for color config (fix #1252)Nico Williams2017-04-291-0/+54
|
* def isempty(g) # Testing 'isempty(empty)' at line number 1364pkoppstein2017-04-151-0/+12
|
* Allow . as {$a:$b} destructuringNicolas Williams2017-03-261-0/+4
|
* Add more destructuring testsNicolas Williams2017-03-261-0/+12
|
* Fix a tripped assertion when generating reducesWilliam Langford2017-03-261-0/+5
| | | | A noop body, while useless, should still compile successfully
* Conditional exprs are not path exprs (fix #1368)Nicolas Williams2017-03-151-0/+5
| | | | | | | | 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.
* Fix off-by-one bug in #1108 fixNicolas Williams2017-03-011-2/+2
|
* Array slice overflows (fix #1108)Nicolas Williams2017-03-011-0/+9
|
* getpath/1 should be a path expression (fix #1358)Nicolas Williams2017-02-281-0/+12
| | | | | | | | | | | 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.
* Add `halt`, `halt_error` builtins (fix #386)Nicolas Williams2017-02-262-0/+35
|
* Fix error message for undefined varsNicolas Williams2017-02-261-1/+1
|
* Make test/shtest test of constant folding robustNicolas Williams2017-02-251-13/+9
| | | | | | | 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.
* Allow var bindings in path expressions (#1347)Nicolas Williams2017-02-211-0/+6
| | | | | 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.
* Add @base64d for decoding base64 #47Shaun Guth2017-02-123-1/+46
|
* Add SQL-style operators (#1322)Nicolas Williams2017-01-301-0/+29
|
* Make first(g) more efficient: extract only 1 valueNicolas Williams2017-01-301-0/+5
| | | | | | | | 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.