@@ -18,27 +18,31 @@ class Case:
1818 Case (description = "empty" , path = "" , want = "$" ),
1919 Case (description = "just root" , path = "$" , want = "$" ),
2020 Case (description = "root dot" , path = "$." , want = "$" ),
21- Case (description = "implicit root dot property" , path = ".thing" , want = "$.thing" ),
22- Case (description = "root dot property" , path = "$.thing" , want = "$.thing" ),
23- Case (description = "root bracket property" , path = "$[thing]" , want = "$.thing" ),
24- Case (description = "root double quoted property" , path = '$["thing"]' , want = "$.thing" ),
25- Case (description = "root single quoted property" , path = "$['thing']" , want = "$.thing" ),
21+ Case (description = "implicit root dot property" , path = ".thing" , want = "$['thing']" ),
22+ Case (description = "root dot property" , path = "$.thing" , want = "$['thing']" ),
23+ Case (description = "root bracket property" , path = "$[thing]" , want = "$['thing']" ),
24+ Case (
25+ description = "root double quoted property" , path = '$["thing"]' , want = "$['thing']"
26+ ),
27+ Case (
28+ description = "root single quoted property" , path = "$['thing']" , want = "$['thing']"
29+ ),
2630 Case (
2731 description = "root quoted property with non-ident chars" ,
2832 path = "$['anything{!%']" ,
29- want = '$[" anything{!%"]' ,
33+ want = "$[' anything{!%']" ,
3034 ),
31- Case (description = "root dot bracket property" , path = "$.[thing]" , want = "$. thing" ),
35+ Case (description = "root dot bracket property" , path = "$.[thing]" , want = "$[' thing'] " ),
3236 Case (description = "root dot index" , path = "$.1" , want = "$[1]" ),
3337 Case (description = "root bracket index" , path = "$[1]" , want = "$[1]" ),
3438 Case (description = "root slice" , path = "$[1:-1]" , want = "$[1:-1:1]" ),
3539 Case (description = "root dot slice" , path = "$.[1:-1]" , want = "$[1:-1:1]" ),
3640 Case (description = "root slice with step" , path = "$[1:-1:2]" , want = "$[1:-1:2]" ),
3741 Case (description = "root slice with empty start" , path = "$[:-1]" , want = "$[:-1:1]" ),
3842 Case (description = "root slice with empty stop" , path = "$[1:]" , want = "$[1::1]" ),
39- Case (description = "root dot wild" , path = "$.*" , want = "$.* " ),
40- Case (description = "root bracket wild" , path = "$[*]" , want = "$.* " ),
41- Case (description = "root dot bracket wild" , path = "$.[*]" , want = "$.* " ),
43+ Case (description = "root dot wild" , path = "$.*" , want = "$[*] " ),
44+ Case (description = "root bracket wild" , path = "$[*]" , want = "$[*] " ),
45+ Case (description = "root dot bracket wild" , path = "$.[*]" , want = "$[*] " ),
4246 Case (description = "root descend" , path = "$.." , want = "$.." ),
4347 Case (description = "root dot descend" , path = "$..." , want = "$.." ),
4448 Case (description = "root selector list" , path = "$[1,2]" , want = "$[1, 2]" ),
@@ -51,117 +55,117 @@ class Case:
5155 Case (
5256 description = "root selector list with properties" ,
5357 path = "$[some,thing]" ,
54- want = "$[some, thing]" ,
58+ want = "$[' some', ' thing' ]" ,
5559 ),
5660 Case (
5761 description = "root selector list with quoted properties" ,
5862 path = "$[\" some\" ,'thing']" ,
59- want = "$[some, thing]" ,
63+ want = "$[' some', ' thing' ]" ,
6064 ),
6165 Case (
6266 description = "implicit root selector list with mixed selectors" ,
6367 path = '$["some",thing, 1, 2:-2:2]' ,
64- want = "$[some, thing, 1, 2:-2:2]" ,
68+ want = "$[' some', ' thing' , 1, 2:-2:2]" ,
6569 ),
6670 Case (
6771 description = "filter self dot property" ,
6872 path = "[?(@.thing)]" ,
69- want = "$[?(@. thing)]" ,
73+ want = "$[?(@[' thing'] )]" ,
7074 ),
7175 Case (
7276 description = "filter root dot property" ,
7377 path = "$.some[?($.thing)]" ,
74- want = "$. some[?($. thing)]" ,
78+ want = "$[' some'] [?($[' thing'] )]" ,
7579 ),
7680 Case (
7781 description = "filter with equality test" ,
7882 path = "$.some[?(@.thing == 7)]" ,
79- want = "$. some[?(@. thing == 7)]" ,
83+ want = "$[' some'] [?(@[' thing'] == 7)]" ,
8084 ),
8185 Case (
8286 description = "filter with >=" ,
8387 path = "$.some[?(@.thing >= 7)]" ,
84- want = "$. some[?(@. thing >= 7)]" ,
88+ want = "$[' some'] [?(@[' thing'] >= 7)]" ,
8589 ),
8690 Case (
8791 description = "filter with >=" ,
8892 path = "$.some[?(@.thing >= 7)]" ,
89- want = "$. some[?(@. thing >= 7)]" ,
93+ want = "$[' some'] [?(@[' thing'] >= 7)]" ,
9094 ),
9195 Case (
9296 description = "filter with !=" ,
9397 path = "$.some[?(@.thing != 7)]" ,
94- want = "$. some[?(@. thing != 7)]" ,
98+ want = "$[' some'] [?(@[' thing'] != 7)]" ,
9599 ),
96100 Case (
97101 description = "filter with <>" ,
98102 path = "$.some[?(@.thing != 7)]" ,
99- want = "$. some[?(@. thing != 7)]" ,
103+ want = "$[' some'] [?(@[' thing'] != 7)]" ,
100104 ),
101105 Case (
102106 description = "filter with regex" ,
103107 path = "$.some[?(@.thing =~ /(foo|bar)/i)]" ,
104- want = "$. some[?(@. thing =~ /(foo|bar)/i)]" ,
108+ want = "$[' some'] [?(@[' thing'] =~ /(foo|bar)/i)]" ,
105109 ),
106110 Case (
107111 description = "filter with list membership test" ,
108112 path = "$.some[?(@.thing in ['foo', 'bar', 42])]" ,
109- want = "$. some[?(@. thing in ['foo', 'bar', 42])]" ,
113+ want = "$[' some'] [?(@[' thing'] in ['foo', 'bar', 42])]" ,
110114 ),
111115 Case (
112116 description = "filter with boolean literals" ,
113117 path = "$.some[?(true == false)]" ,
114- want = "$. some[?(True == False )]" ,
118+ want = "$[' some'] [?(true == false )]" ,
115119 ),
116120 Case (
117121 description = "filter with nil literal" ,
118122 path = "$.some[?(@.thing == nil)]" ,
119- want = "$. some[?(@. thing == nil)]" ,
123+ want = "$[' some'] [?(@[' thing'] == nil)]" ,
120124 ),
121125 Case (
122126 description = "null is the same as nil" ,
123127 path = "$.some[?(@.thing == null)]" ,
124- want = "$. some[?(@. thing == nil)]" ,
128+ want = "$[' some'] [?(@[' thing'] == nil)]" ,
125129 ),
126130 Case (
127131 description = "none is the same as nil" ,
128132 path = "$.some[?(@.thing == none)]" ,
129- want = "$. some[?(@. thing == nil)]" ,
133+ want = "$[' some'] [?(@[' thing'] == nil)]" ,
130134 ),
131135 Case (
132136 description = "filter with test for undefined" ,
133137 path = "$.some[?(@.thing == undefined)]" ,
134- want = "$. some[?(@. thing == undefined)]" ,
138+ want = "$[' some'] [?(@[' thing'] == undefined)]" ,
135139 ),
136140 Case (
137141 description = "missing is the same as undefined" ,
138142 path = "$.some[?(@.thing == missing)]" ,
139- want = "$. some[?(@. thing == undefined)]" ,
143+ want = "$[' some'] [?(@[' thing'] == undefined)]" ,
140144 ),
141145 Case (
142146 description = "filter with string literal" ,
143147 path = "$.some[?(@.thing == 'foo')]" ,
144- want = "$. some[?(@. thing == 'foo')]" ,
148+ want = "$[' some'] [?(@[' thing'] == 'foo')]" ,
145149 ),
146150 Case (
147151 description = "filter with integer literal" ,
148152 path = "$.some[?(@.thing == 1)]" ,
149- want = "$. some[?(@. thing == 1)]" ,
153+ want = "$[' some'] [?(@[' thing'] == 1)]" ,
150154 ),
151155 Case (
152156 description = "filter with float literal" ,
153157 path = "$.some[?(@.thing == 1.1)]" ,
154- want = "$. some[?(@. thing == 1.1)]" ,
158+ want = "$[' some'] [?(@[' thing'] == 1.1)]" ,
155159 ),
156160 Case (
157161 description = "filter with logical not" ,
158162 path = "$.some[?(@.thing > 1 and not $.other)]" ,
159- want = "$. some[?(@. thing > 1 and not $. other)]" ,
163+ want = "$[' some'] [?(@[' thing'] > 1 and not $[' other'] )]" ,
160164 ),
161165 Case (
162166 description = "filter with grouped expression" ,
163167 path = "$.some[?(@.thing > 1 and ($.foo or $.bar))]" ,
164- want = "$. some[?(@. thing > 1 and $. foo or $. bar)]" ,
168+ want = "$[' some'] [?(@[' thing'] > 1 and $[' foo'] or $[' bar'] )]" ,
165169 ),
166170]
167171
0 commit comments