You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

445 lines
11 KiB

---
test case: 'Invalid path $.a[] in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.a[]
out:
result: fail
---
test case: 'Invalid path $a in {"a":1}'
in:
json: '{"a":1}'
path: $a
out:
result: fail
---
test case: 'Invalid path "" in {"a":1}'
in:
json: '{"a":1}'
path: ""
out:
result: fail
---
test case: 'Invalid location $.x.b in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.x.b
out:
result: fail
---
test case: 'Invalid location $[3] in [1, 2, 3]'
in:
json: '[1, 2, 3]'
path: $[3]
out:
result: fail
---
test case: 'Valid location $[0] in [1, 2, 3]'
in:
json: '[1, 2, 3]'
path: $[0]
out:
result: succeed
value: 1
---
test case: 'Valid location $[1] in [1, 2, 3]'
in:
json: '[1, 2, 3]'
path: $[1]
out:
result: succeed
value: 2
---
test case: 'Valid location $[2] in [1, 2, 3]'
in:
json: '[1, 2, 3]'
path: $[2]
out:
result: succeed
value: 3
---
test case: 'Valid location $[1][0] in [1,["a","b","c"],3]'
in:
json: '[1,["a","b","c"],3]'
path: $[1][0]
out:
result: succeed
value: a
---
test case: 'Valid location $.x[1][2] in {"x":[1, ["a", "b", "c"], 3]}'
in:
json: '{"x":[1, ["a", "b", "c"], 3]}'
path: $.x[1][2]
out:
result: succeed
value: c
---
test case: 'Valid location $.a in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.a
out:
result: succeed
value: '{"b": [{"x":10}, 2, 3] }'
---
test case: 'Valid location $.a in {"a" : {"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a" : {"b": [{"x":10}, 2, 3] }}'
path: $.a
out:
result: succeed
value: '{"b": [{"x":10}, 2, 3] }'
---
test case: 'Valid location $.a.b in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.a.b
out:
result: succeed
value: '[{"x":10}, 2, 3]'
---
test case: 'Valid location $.a.b[0] in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.a.b[0]
out:
result: succeed
value: '{"x":10}'
---
test case: 'Valid location $.a.b[1] in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.a.b[1]
out:
result: succeed
value: 2
---
test case: 'Valid location $.a.b[2] in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.a.b[2]
out:
result: succeed
value: 3
---
test case: ZBX-13782, empty string
in:
json: '{"DeviceLog": ""}'
path: $.DeviceLog
out:
result: succeed
value: ""
---
test case: ZBX-13782, 1 non-escaped ASCII character
in:
json: '{"DeviceLog": "a"}'
path: $.DeviceLog
out:
result: succeed
value: "a"
---
test case: ZBX-13782, 2 non-escaped ASCII characters
in:
json: '{"DeviceLog": "aF"}'
path: $.DeviceLog
out:
result: succeed
value: "aF"
---
test case: ZBX-13782, 3 non-escaped ASCII characters
in:
json: '{"DeviceLog": "0aF"}'
path: $.DeviceLog
out:
result: succeed
value: "0aF"
---
test case: ZBX-13782, many non-escaped ASCII characters
in:
json: '{"DeviceLog": "0aF12345qwertZXCVBN;"}'
path: $.DeviceLog
out:
result: succeed
value: "0aF12345qwertZXCVBN;"
---
test case: ZBX-13782, escaped quotation mark
in:
json: '{"DeviceLog": "\""}'
path: $.DeviceLog
out:
result: succeed
value: "\""
---
test case: ZBX-13782, escaped reverse solidus
in:
json: '{"DeviceLog": "\\"}'
path: $.DeviceLog
out:
result: succeed
value: "\\"
---
test case: ZBX-13782, escaped solidus
in:
json: '{"DeviceLog": "\/"}'
path: $.DeviceLog
out:
result: succeed
value: "/"
---
test case: ZBX-13782, escaped backspace
in:
json: '{"DeviceLog": "\b"}'
path: $.DeviceLog
out:
result: succeed
value: "\b"
---
test case: ZBX-13782, escaped form feed
in:
json: '{"DeviceLog": "\f"}'
path: $.DeviceLog
out:
result: succeed
value: "\f"
---
test case: ZBX-13782, escaped line feed
in:
json: '{"DeviceLog": "\n"}'
path: $.DeviceLog
out:
result: succeed
value: "\n"
---
test case: ZBX-13782, escaped carriage return
in:
json: '{"DeviceLog": "\r"}'
path: $.DeviceLog
out:
result: succeed
value: "\r"
---
test case: ZBX-13782, escaped tab
in:
json: '{"DeviceLog": "\t"}'
path: $.DeviceLog
out:
result: succeed
value: "\t"
---
test case: ZBX-13782, escaped character in the beginning of string
in:
json: '{"DeviceLog": "\tAB"}'
path: $.DeviceLog
out:
result: succeed
value: "\tAB"
---
test case: ZBX-13782, escaped character in the middle of string
in:
json: '{"DeviceLog": "A\tB"}'
path: $.DeviceLog
out:
result: succeed
value: "A\tB"
---
test case: ZBX-13782, escaped character in the end of string
in:
json: '{"DeviceLog": "AB\t"}'
path: $.DeviceLog
out:
result: succeed
value: "AB\t"
---
test case: ZBX-13782, several escaped character in string
in:
json: '{"DeviceLog": "\"\\\/\b\f\n\r\t"}'
path: $.DeviceLog
out:
result: succeed
value: "\"\\/\b\f\n\r\t"
---
test case: ZBX-13782, escaped Unicode character \u0000
in:
json: '{"DeviceLog": "A\u0000BC"}'
path: $.DeviceLog
out:
result: succeed
value: "A"
---
test case: ZBX-13782, A as escaped Unicode character
in:
json: '{"DeviceLog": "\u0041"}'
path: $.DeviceLog
out:
result: succeed
value: "A"
---
test case: ZBX-13782, escaped Unicode character \u00e4 which translates into 2 byte UTF-8
in:
json: '{"DeviceLog": "AB-\u00e4-C"}'
path: $.DeviceLog
out:
result: succeed
value: "AB-ä-C"
---
test case: ZBX-13782, escaped Unicode character \u00D1 which translates into 2 byte UTF-8
in:
json: '{"DeviceLog": "AB-\u00D1-C"}'
path: $.DeviceLog
out:
result: succeed
value: "AB-Ñ-C"
---
test case: ZBX-13782, escaped Unicode character \u042F which translates into 2 byte UTF-8
in:
json: '{"DeviceLog": "AB-\u042F-C"}'
path: $.DeviceLog
out:
result: succeed
value: "AB-Я-C"
---
test case: ZBX-13782, escaped Unicode character \u0800 which translates into 3 byte UTF-8
in:
json: '{"DeviceLog": "AB-\u0800-C"}'
path: $.DeviceLog
out:
result: succeed
value: "AB-ࠀ-C"
---
test case: ZBX-13782, escaped Unicode character \u10c0 which translates into 3 byte UTF-8
in:
json: '{"DeviceLog": "AB-\u10c0-C"}'
path: $.DeviceLog
out:
result: succeed
value: "AB-Ⴠ-C"
---
test case: ZBX-13782, escaped Unicode character \u10c0 which translates into 3 byte UTF-8
in:
json: '{"DeviceLog": "\u10c0"}'
path: $.DeviceLog
out:
result: succeed
value: "Ⴠ"
---
test case: ZBX-13782, escaped Unicode character \u20E0 which translates into 3 byte UTF-8
in:
json: '{"DeviceLog": "\u20E0"}'
path: $.DeviceLog
out:
result: succeed
value: "⃠"
---
test case: ZBX-13782, string with escaped Unicode character \u20E0 which translates into 3 byte UTF-8
in:
json: '{"DeviceLog": "-\u20E0-"}'
path: $.DeviceLog
out:
result: succeed
value: "-⃠-"
---
test case: ZBX-13782, escaped Unicode character \uFFFD (replacement character)
in:
json: '{"DeviceLog": "AB-\uFFFD-C"}'
path: $.DeviceLog
out:
result: succeed
value: "AB-<2D>-C"
---
test case: ZBX-13782, escaped Unicode character Curling Stone U+1F94C
in:
json: '{"DeviceLog": "\uD83E\uDD4C"}'
path: $.DeviceLog
out:
result: succeed
value: "🥌"
---
test case: ZBX-13782, several escaped Unicode characters Zanabazar Square Letter Za U+11A28
in:
json: '{"DeviceLog": "\uD806\uDE28-\uD806\uDE28-\uD806\uDE28-\uD806\uDE28"}'
path: $.DeviceLog
out:
result: succeed
value: "𑨨-𑨨-𑨨-𑨨"
---
test case: ZBX-13782, several escaped Unicode characters Linear B Syllable B008 A U+10000
in:
json: '{"DeviceLog": "\uD800\uDC00\uD800\uDC00\uD800\uDC00\uD800\uDC00"}'
path: $.DeviceLog
out:
result: succeed
value: "𐀀𐀀𐀀𐀀"
---
test case: 'Invalid path $.*.b in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.*.b
out:
result: fail
---
test case: 'Invalid path $.a.b[?(@.x == "10")] in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.a.b[?(@.x == "10")]
out:
result: fail
---
test case: 'Invalid path $["a", "x"].b in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $['a', 'x'].b
out:
result: fail
---
test case: 'Invalid path $.a.b[1,2] in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.a.b[1,2]
out:
result: fail
---
test case: 'Invalid path $.a.b.length() in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $.a.b.length()
out:
result: fail
---
test case: 'Invalid path $..b in {"a":{"b": [{"x":10}, 2, 3] }}'
in:
json: '{"a":{"b": [{"x":10}, 2, 3] }}'
path: $..b
out:
result: fail
---
test case: 'Valid 64 element deep array test'
in:
json: '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'
path: $[0]
out:
result: succeed
value: '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'
---
test case: 'Invalid 65 element deep array test'
in:
json: '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'
path: $
out:
result: 'cannot parse as a valid JSON object: JSON depth exceeds 64 at: ''[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'''
---
test case: 'Valid 64 element deep object test'
in:
json: '{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}'
path: $.a
out:
result: succeed
value: '{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}'
---
test case: 'Invalid 65 element deep object test'
in:
json: '{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":{}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}'
path: $.a
out:
result: 'cannot parse as a valid JSON object: JSON depth exceeds 64 at: ''{}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}'''
...