summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2016-01-17 11:23:17 -0600
committerNicolas Williams <nico@cryptonector.com>2016-01-17 12:45:01 -0600
commit062f86a625a2ec3dbf2a24a18fa5015fd8222674 (patch)
tree8873b41f2629b7dbd9a4d9f02ab7e8fff6304185
parentc3d13260a78cfd751b962b7c110c5e7336b54401 (diff)
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.
-rw-r--r--Makefile.am2
-rw-r--r--appveyor.yml2
-rw-r--r--tests/jq.test22
-rw-r--r--tests/optional.test24
-rwxr-xr-xtests/optionaltest5
5 files changed, 38 insertions, 17 deletions
diff --git a/Makefile.am b/Makefile.am
index 83f99071..8a6ace42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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)
diff --git a/appveyor.yml b/appveyor.yml
index c0b9715a..3fa60721 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -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
diff --git a/tests/jq.test b/tests/jq.test
index 4ca1f66b..546f2400 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -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
index 00000000..aabe3912
--- /dev/null
+++ b/tests/optional.test
@@ -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
index 00000000..b2444a40
--- /dev/null
+++ b/tests/optionaltest
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. "${0%/*}/setup"
+
+$VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/optional.test