@@ -177,6 +177,58 @@ def unicode_strings_can_be_used_as_input():
177
177
)
178
178
179
179
180
+ @istest
181
+ def record_separator_character_accepted_in_input ():
182
+ assert_equal (
183
+ [],
184
+ list (jq .compile ("." ).input (text = '\x1e ' ))
185
+ )
186
+ assert_equal (
187
+ [],
188
+ list (jq .compile ("." ).input (text = '\x1e \x1e ' ))
189
+ )
190
+ assert_equal (
191
+ [{}],
192
+ list (jq .compile ("." ).input (text = '\x1e {}' ))
193
+ )
194
+ assert_equal (
195
+ [{}],
196
+ list (jq .compile ("." ).input (text = '\x1e \x1e {}' ))
197
+ )
198
+ assert_equal (
199
+ [{}],
200
+ list (jq .compile ("." ).input (text = '{}\x1e ' ))
201
+ )
202
+ assert_equal (
203
+ [{}],
204
+ list (jq .compile ("." ).input (text = '{}\x1e \x1e ' ))
205
+ )
206
+ assert_equal (
207
+ [{}],
208
+ list (jq .compile ("." ).input (text = '\x1e {}\x1e ' ))
209
+ )
210
+ assert_equal (
211
+ [{},[]],
212
+ list (jq .compile ("." ).input (text = '{}\x1e []' ))
213
+ )
214
+ assert_equal (
215
+ [{},[]],
216
+ list (jq .compile ("." ).input (text = '{}\x1e \x1e []' ))
217
+ )
218
+ assert_equal (
219
+ [{},[]],
220
+ list (jq .compile ("." ).input (text = '\x1e {}\x1e []' ))
221
+ )
222
+ assert_equal (
223
+ [{},[]],
224
+ list (jq .compile ("." ).input (text = '{}\x1e []\x1e ' ))
225
+ )
226
+ assert_equal (
227
+ [{},[]],
228
+ list (jq .compile ("." ).input (text = '\x1e {}\x1e []\x1e ' ))
229
+ )
230
+
231
+
180
232
@istest
181
233
def unicode_strings_can_be_used_as_programs ():
182
234
assert_equal (
@@ -212,6 +264,21 @@ def parse_json_all_inputs_accepted():
212
264
assert_equal (True , next (jq .parse_json (text = b"true" )))
213
265
assert_equal (True , next (jq .parse_json (text_iter = iter ([b"true" ]))))
214
266
267
+ @istest
268
+ def parse_json_record_separator_character_accepted ():
269
+ assert_equal ([], list (jq .parse_json (text = '\x1e ' )))
270
+ assert_equal ([], list (jq .parse_json (text = '\x1e \x1e ' )))
271
+ assert_equal ([{}], list (jq .parse_json (text = '\x1e {}' )))
272
+ assert_equal ([{}], list (jq .parse_json (text = '\x1e \x1e {}' )))
273
+ assert_equal ([{}], list (jq .parse_json (text = '{}\x1e ' )))
274
+ assert_equal ([{}], list (jq .parse_json (text = '{}\x1e \x1e ' )))
275
+ assert_equal ([{}], list (jq .parse_json (text = '\x1e {}\x1e ' )))
276
+ assert_equal ([{},[]], list (jq .parse_json (text = '{}\x1e []' )))
277
+ assert_equal ([{},[]], list (jq .parse_json (text = '{}\x1e \x1e []' )))
278
+ assert_equal ([{},[]], list (jq .parse_json (text = '\x1e {}\x1e []' )))
279
+ assert_equal ([{},[]], list (jq .parse_json (text = '{}\x1e []\x1e ' )))
280
+ assert_equal ([{},[]], list (jq .parse_json (text = '\x1e {}\x1e []\x1e ' )))
281
+
215
282
@istest
216
283
def parse_json_file_works ():
217
284
fp = io .StringIO ('{"abc": "def"}' )
0 commit comments