summaryrefslogtreecommitdiffstats
path: root/test/json-structure
diff options
context:
space:
mode:
Diffstat (limited to 'test/json-structure')
-rw-r--r--test/json-structure/arrays-in-object/check.txt4
-rw-r--r--test/json-structure/arrays-in-object/input.json10
-rw-r--r--test/json-structure/multiple-ranges/check.txt5
-rw-r--r--test/json-structure/multiple-ranges/input.json49
-rw-r--r--test/json-structure/nested-arrays-mixed-2/check.txt3
-rw-r--r--test/json-structure/nested-arrays-mixed-2/input.json15
-rw-r--r--test/json-structure/nested-arrays-mixed/check.txt3
-rw-r--r--test/json-structure/nested-arrays-mixed/input.json15
-rw-r--r--test/json-structure/nested-arrays/check.txt1
-rw-r--r--test/json-structure/nested-arrays/input.json5
-rw-r--r--test/json-structure/no-value-nodes/01.json1
-rw-r--r--test/json-structure/no-value-nodes/02.json1
-rw-r--r--test/json-structure/no-value-nodes/03.json1
-rw-r--r--test/json-structure/no-value-nodes/04.json1
-rw-r--r--test/json-structure/repeat-objects-2/check.txt6
-rw-r--r--test/json-structure/repeat-objects-2/input.json6
-rw-r--r--test/json-structure/repeat-objects/check.txt2
-rw-r--r--test/json-structure/repeat-objects/input.json6
18 files changed, 134 insertions, 0 deletions
diff --git a/test/json-structure/arrays-in-object/check.txt b/test/json-structure/arrays-in-object/check.txt
new file mode 100644
index 0000000..1f4654e
--- /dev/null
+++ b/test/json-structure/arrays-in-object/check.txt
@@ -0,0 +1,4 @@
+$object['footnotes'].value
+$object['rows'].array[4].object(*)['age'].value
+$object['rows'].array[4].object(*)['error'].value
+$object['rows'].array[4].object(*)['name'].value
diff --git a/test/json-structure/arrays-in-object/input.json b/test/json-structure/arrays-in-object/input.json
new file mode 100644
index 0000000..2b5dbf1
--- /dev/null
+++ b/test/json-structure/arrays-in-object/input.json
@@ -0,0 +1,10 @@
+{
+ "rows": [
+ {"name": "a", "age": 12},
+ {"name": "b", "age": 13},
+ {"name": "c", "age": 14},
+ {"error": -1}
+ ],
+
+ "footnotes": "some footnotes."
+}
diff --git a/test/json-structure/multiple-ranges/check.txt b/test/json-structure/multiple-ranges/check.txt
new file mode 100644
index 0000000..49cf18b
--- /dev/null
+++ b/test/json-structure/multiple-ranges/check.txt
@@ -0,0 +1,5 @@
+$object['data'].array[7].object(*)['category'].value
+$object['data'].array[7].object(*)['records'].array[7].object(*)['id'].value
+$object['data'].array[7].object(*)['records'].array[7].object(*)['ref'].value
+$object['data'].array[7].object(*)['region'].value
+$object['misc'].array[2].array(*)[3].value[0,1,2]
diff --git a/test/json-structure/multiple-ranges/input.json b/test/json-structure/multiple-ranges/input.json
new file mode 100644
index 0000000..e604b13
--- /dev/null
+++ b/test/json-structure/multiple-ranges/input.json
@@ -0,0 +1,49 @@
+{
+ "data": [
+ {"category": "A", "region": "en-US",
+ "records": [
+ {"id": 1000, "ref": "A123456789"},
+ {"id": 1001, "ref": "A987654321"}
+ ]
+ },
+ {"category": "B", "region": "ja-JP",
+ "records": [
+ {"id": 2000, "ref": "B123456789"},
+ {"id": 2001, "ref": "B987654321"},
+ {"id": 2002, "ref": "B987654323"}
+ ]
+ },
+ {"category": "C", "region": "fr-CA",
+ "records": [
+ {"id": 3000, "ref": "C123456789"},
+ {"id": 3001, "ref": "C987654320"},
+ {"id": 3002, "ref": "C987654321"},
+ {"id": 3003, "ref": "C987654322"},
+ {"id": 3004, "ref": "C987654323"},
+ {"id": 3005, "ref": "C987654324"},
+ {"id": 3006, "ref": "C987654325"}
+ ]
+ },
+ {"category": "D", "region": "unknown",
+ "records": [
+ {"id": 4000, "ref": "D123456789"},
+ ]
+ },
+ {"category": "E", "records": []},
+ {"category": "F",
+ "records": [
+ {"id": 6000, "ref": "F123456789"}
+ ]
+ },
+ {"category": "G", "region": "en-GB",
+ "records": [
+ {"id": 7000, "ref": "G123456789"},
+ {"id": 7000, "ref": "G123456780"}
+ ]
+ }
+ ],
+ "misc": [
+ [1, 2, 3],
+ [4, 5, 6],
+ ]
+} \ No newline at end of file
diff --git a/test/json-structure/nested-arrays-mixed-2/check.txt b/test/json-structure/nested-arrays-mixed-2/check.txt
new file mode 100644
index 0000000..1347175
--- /dev/null
+++ b/test/json-structure/nested-arrays-mixed-2/check.txt
@@ -0,0 +1,3 @@
+$array[2].array(*)[3].object['age'].value
+$array[2].array(*)[3].object['name'].value
+$array[2].array(*)[3].value[1,2]
diff --git a/test/json-structure/nested-arrays-mixed-2/input.json b/test/json-structure/nested-arrays-mixed-2/input.json
new file mode 100644
index 0000000..b63feb3
--- /dev/null
+++ b/test/json-structure/nested-arrays-mixed-2/input.json
@@ -0,0 +1,15 @@
+[
+ [
+ 3,
+ 4,
+ 5
+ ],
+ [
+ {
+ "name": "Jane Doe",
+ "age": -1
+ },
+ 1,
+ 2
+ ]
+]
diff --git a/test/json-structure/nested-arrays-mixed/check.txt b/test/json-structure/nested-arrays-mixed/check.txt
new file mode 100644
index 0000000..1347175
--- /dev/null
+++ b/test/json-structure/nested-arrays-mixed/check.txt
@@ -0,0 +1,3 @@
+$array[2].array(*)[3].object['age'].value
+$array[2].array(*)[3].object['name'].value
+$array[2].array(*)[3].value[1,2]
diff --git a/test/json-structure/nested-arrays-mixed/input.json b/test/json-structure/nested-arrays-mixed/input.json
new file mode 100644
index 0000000..d0d7617
--- /dev/null
+++ b/test/json-structure/nested-arrays-mixed/input.json
@@ -0,0 +1,15 @@
+[
+ [
+ {
+ "name": "Jane Doe",
+ "age": -1
+ },
+ 1,
+ 2
+ ],
+ [
+ 3,
+ 4,
+ 5
+ ]
+]
diff --git a/test/json-structure/nested-arrays/check.txt b/test/json-structure/nested-arrays/check.txt
new file mode 100644
index 0000000..03123e8
--- /dev/null
+++ b/test/json-structure/nested-arrays/check.txt
@@ -0,0 +1 @@
+$array[2].array(*)[3].value[0,1,2]
diff --git a/test/json-structure/nested-arrays/input.json b/test/json-structure/nested-arrays/input.json
new file mode 100644
index 0000000..e4e6b99
--- /dev/null
+++ b/test/json-structure/nested-arrays/input.json
@@ -0,0 +1,5 @@
+[
+ [0, 1, 2],
+ [3, 4, 5]
+]
+
diff --git a/test/json-structure/no-value-nodes/01.json b/test/json-structure/no-value-nodes/01.json
new file mode 100644
index 0000000..fe51488
--- /dev/null
+++ b/test/json-structure/no-value-nodes/01.json
@@ -0,0 +1 @@
+[]
diff --git a/test/json-structure/no-value-nodes/02.json b/test/json-structure/no-value-nodes/02.json
new file mode 100644
index 0000000..1721244
--- /dev/null
+++ b/test/json-structure/no-value-nodes/02.json
@@ -0,0 +1 @@
+[[]]
diff --git a/test/json-structure/no-value-nodes/03.json b/test/json-structure/no-value-nodes/03.json
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/test/json-structure/no-value-nodes/03.json
@@ -0,0 +1 @@
+{}
diff --git a/test/json-structure/no-value-nodes/04.json b/test/json-structure/no-value-nodes/04.json
new file mode 100644
index 0000000..b672212
--- /dev/null
+++ b/test/json-structure/no-value-nodes/04.json
@@ -0,0 +1 @@
+{"k": []}
diff --git a/test/json-structure/repeat-objects-2/check.txt b/test/json-structure/repeat-objects-2/check.txt
new file mode 100644
index 0000000..9e406e0
--- /dev/null
+++ b/test/json-structure/repeat-objects-2/check.txt
@@ -0,0 +1,6 @@
+$array[3].object(*)['age'].value
+$array[3].object(*)['name'].value
+$array[3].object(*)['props'].object['alpha'].value
+$array[3].object(*)['props'].object['beta'].value
+$array[3].object(*)['props'].object['gamma'].value
+$array[3].object(*)['props'].object['theta'].value
diff --git a/test/json-structure/repeat-objects-2/input.json b/test/json-structure/repeat-objects-2/input.json
new file mode 100644
index 0000000..54ba1cc
--- /dev/null
+++ b/test/json-structure/repeat-objects-2/input.json
@@ -0,0 +1,6 @@
+[
+ {"name": "a", "age": 12, "props": {"alpha": 1, "beta": 2}},
+ {"name": "b", "age": 13, "props": {"gamma": 3}},
+ {"name": "c", "age": 14, "props": {"theta": 4}},
+]
+
diff --git a/test/json-structure/repeat-objects/check.txt b/test/json-structure/repeat-objects/check.txt
new file mode 100644
index 0000000..df6de0b
--- /dev/null
+++ b/test/json-structure/repeat-objects/check.txt
@@ -0,0 +1,2 @@
+$array[4].object(*)['age'].value
+$array[4].object(*)['name'].value
diff --git a/test/json-structure/repeat-objects/input.json b/test/json-structure/repeat-objects/input.json
new file mode 100644
index 0000000..27882a4
--- /dev/null
+++ b/test/json-structure/repeat-objects/input.json
@@ -0,0 +1,6 @@
+[
+ {"name": "a", "age": 12},
+ {"name": "b", "age": true},
+ {"name": "c", "age": null},
+ {"name": "d", "age": "n/a"},
+]