]> granicus.if.org Git - jq/commitdiff
Enable more tests on Windows; move sort_by tests
authorNicolas Williams <nico@cryptonector.com>
Sun, 17 Jan 2016 17:23:17 +0000 (11:23 -0600)
committerNicolas Williams <nico@cryptonector.com>
Sun, 17 Jan 2016 18:45:01 +0000 (12:45 -0600)
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.

Makefile.am
appveyor.yml
tests/jq.test
tests/optional.test [new file with mode: 0644]
tests/optionaltest [new file with mode: 0755]

index 83f99071071d5c37ae81f57a713b45b0706965b9..8a6ace42c90eb01c58bb9dabbac988a1df94925b 100644 (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)
 
 
index c0b9715aa2e63a56cbd630f7716f796e1dcf078a..3fa60721082e916d710f5bf0586636d32f3b271b 100644 (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
index 4ca1f66b86163ad19eeb352b882a5010bbe570e9..546f24008d0e8f0f0fe081226eae3465ef035985 100644 (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:
 
diff --git a/tests/optional.test b/tests/optional.test
new file mode 100644 (file)
index 0000000..aabe391
--- /dev/null
@@ -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"
+
+
diff --git a/tests/optionaltest b/tests/optionaltest
new file mode 100755 (executable)
index 0000000..b2444a4
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. "${0%/*}/setup"
+
+$VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/optional.test