1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

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.
This commit is contained in:
Nicolas Williams
2016-01-17 11:23:17 -06:00
parent c3d13260a7
commit 062f86a625
5 changed files with 38 additions and 17 deletions

View File

@ -111,7 +111,7 @@ endif
### Tests (make check)
TESTS = tests/mantest tests/jqtest tests/onigtest tests/shtest
TESTS = tests/optionaltest tests/mantest tests/jqtest tests/onigtest tests/shtest
TESTS_ENVIRONMENT = NO_VALGRIND=$(NO_VALGRIND)

View File

@ -24,7 +24,7 @@ build_script:
- file jq.exe
test_script:
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && make -j4 'TESTS=tests/mantest tests/onigtest' check"
- bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && make -j4 'TESTS=tests/mantest tests/jqtest tests/onigtest' check"
artifacts:
- path: jq-package.zip

View File

@ -419,11 +419,11 @@ null
[0]
[0]
%%FAIL
%%FAIL IGNORE MSG
. as [] | null
jq: error: syntax error, unexpected ']', expecting '$' or '[' or '{' (Unix shell quoting issues?) at <top-level>, line 1:
%%FAIL
%%FAIL IGNORE MSG
. as {} | null
jq: error: syntax error, unexpected '}' (Unix shell quoting issues?) at <top-level>, line 1:
@ -1044,13 +1044,7 @@ sort
[42,[2,5,3,11],10,{"a":42,"b":2},{"a":42},true,2,[2,6],"hello",null,[2,5,6],{"a":[],"b":1},"abc","ab",[3,10],{},false,"abcd",null]
[null,null,false,true,2,10,42,"ab","abc","abcd","hello",[2,5,3,11],[2,5,6],[2,6],[3,10],{},{"a":42},{"a":42,"b":2},{"a":[],"b":1}]
(sort_by(.b) | sort_by(.a)), sort_by(.a, .b), sort_by(.b, .c), group_by(.b), group_by(.a + .b - .c == 2)
[{"a": 1, "b": 4, "c": 14}, {"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}, {"a": 0, "b": 2, "c": 43}]
[{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}]
[{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}]
[{"a": 4, "b": 1, "c": 3}, {"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 3}, {"a": 1, "b": 4, "c": 14}]
[[{"a": 4, "b": 1, "c": 3}], [{"a": 0, "b": 2, "c": 43}], [{"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}]]
[[{"a": 1, "b": 4, "c": 14}, {"a": 0, "b": 2, "c": 43}], [{"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}]]
# Tests of `sort_by` and `group_by` have been moved to tests/sort.test
unique
[1,2,5,3,5,3,1,3]
@ -1190,15 +1184,13 @@ bsearch(4)
[1,2,3]
-4
[strptime("%Y-%m-%dT%H:%M:%SZ")|(.,mktime)]
"2015-03-05T23:51:47Z"
[[2015,2,5,23,51,47,4,63],1425599507]
# strptime tests are in optional.test
strftime("%Y-%m-%dT%H:%M:%SZ")
[2015,2,5,23,51,47,4,63]
"2015-03-05T23:51:47Z"
strftime("%A, %B %e, %Y")
strftime("%A, %B %d, %Y")
1435677542.822351
"Tuesday, June 30, 2015"
@ -1247,7 +1239,7 @@ modulemeta
import "syntaxerror" as e; .
jq: error: syntax error, unexpected ';', expecting $end (Unix shell quoting issues?) at /home/nico/ws/jq/tests/modules/syntaxerror/syntaxerror.jq, line 1:
%%FAIL
%%FAIL IGNORE MSG
%::wat
jq: error: syntax error, unexpected '%', expecting $end (Unix shell quoting issues?) at <top-level>, line 1:
@ -1307,7 +1299,7 @@ true
[range(-99/2;99/2;1)] as $orig | [$orig[]|pow(2;.)|log2] as $back | ($orig|keys)[]|. as $k | (($orig|.[$k])-($back|.[$k]))|if . < 0 then . * -1 else . end|select(.>.00005)
null
%%FAIL
%%FAIL IGNORE MSG
}
jq: error: syntax error, unexpected INVALID_CHARACTER, expecting $end (Unix shell quoting issues?) at <top-level>, line 1:

24
tests/optional.test Normal file
View File

@ -0,0 +1,24 @@
# See tests/jq.test and the jq manual for more information.
# As long as we use the C qsort() function, this test can fail if the C
# qsort() implementation we get is not stable (Quicksort is not stable).
(sort_by(.b) | sort_by(.a)), sort_by(.a, .b), sort_by(.b, .c), group_by(.b), group_by(.a + .b - .c == 2)
[{"a": 1, "b": 4, "c": 14}, {"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}, {"a": 0, "b": 2, "c": 43}]
[{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}]
[{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}]
[{"a": 4, "b": 1, "c": 3}, {"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 3}, {"a": 1, "b": 4, "c": 14}]
[[{"a": 4, "b": 1, "c": 3}], [{"a": 0, "b": 2, "c": 43}], [{"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}]]
[[{"a": 1, "b": 4, "c": 14}, {"a": 0, "b": 2, "c": 43}], [{"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}]]
# strptime() is not available on mingw/WIN32
[strptime("%Y-%m-%dT%H:%M:%SZ")|(.,mktime)]
"2015-03-05T23:51:47Z"
[[2015,2,5,23,51,47,4,63],1425599507]
# %e is not available on mingw/WIN32
strftime("%A, %B %e, %Y")
1435677542.822351
"Tuesday, June 30, 2015"

5
tests/optionaltest Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
. "${0%/*}/setup"
$VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/optional.test