Add support for JSON sequence MIME type
Per draft-ietf-json-text-sequence-07 (which soon will be published as an RFC).
This commit is contained in:
1 parent
3411167c03
commit
89791a000b
5 files changed
+141
-21
No files matched your search
@@ -78,6 +78,46 @@ case "$v" in
|
||||
*) true;;
|
||||
esac
|
||||
|
||||
## Test JSON sequence support
|
||||
|
||||
cat > $d/expected <<EOF
|
||||
ignoring parse error: Potentially truncated top-level numeric value at line 1, column 2
|
||||
ignoring parse error: Truncated value at line 2, column 5
|
||||
ignoring parse error: Truncated value at line 2, column 25
|
||||
ignoring parse error: Truncated value at line 2, column 41
|
||||
EOF
|
||||
printf '1\0362 3\n[0,1\036[4,5]true"ab"{"c":4\036{}{"d":5,"e":6"\036false\n'|$VALGRIND $Q ./jq -ces --seq '. == [2,3,[4,5],true,"ab",{},false]' > /dev/null 2> $d/out
|
||||
cmp $d/out $d/expected
|
||||
|
||||
cat > $d/expected <<EOF
|
||||
ignoring parse error: Potentially truncated top-level numeric value at line 1, column 2
|
||||
ignoring parse error: Truncated value at line 2, column 5
|
||||
ignoring parse error: Truncated value at line 2, column 25
|
||||
ignoring parse error: Invalid literal at line 3, column 1
|
||||
EOF
|
||||
printf '1\0362 3\n[0,1\036[4,5]true"ab"{"c":4\036{}{"d":5,"e":6"false\n\036null'|$VALGRIND $Q ./jq -ces --seq '. == [2,3,[4,5],true,"ab",{},null]' > /dev/null 2> $d/out
|
||||
cmp $d/out $d/expected
|
||||
|
||||
# Note that here jq sees no inputs at all but it still succeeds because
|
||||
# --seq ignores parse errors
|
||||
cat > $d/expected <<EOF
|
||||
ignoring parse error: Unfinished string
|
||||
EOF
|
||||
printf '"foo'|./jq -ce --seq . > $d/out 2>&1
|
||||
cmp $d/out $d/expected
|
||||
|
||||
# Numeric values truncated by EOF are ignored
|
||||
cat > $d/expected <<EOF
|
||||
ignoring parse error: Potentially truncated top-level numeric value
|
||||
EOF
|
||||
printf '1'|./jq -ce --seq . > $d/out 2>&1
|
||||
cmp $d/out $d/expected
|
||||
|
||||
cat > $d/expected <<EOF
|
||||
EOF
|
||||
printf '1\n'|./jq -ces --seq '. == [1]' >/dev/null 2> $d/out
|
||||
cmp $d/out $d/expected
|
||||
|
||||
## Test library/module system
|
||||
|
||||
mods=$PWD/tests/modules
|
||||
|
||||
Reference in new issue
Block a user