@@ -210,64 +210,64 @@ def test_parse_arrays_with_allow_trailing_comma
210
210
end
211
211
212
212
def test_parse_object_with_allow_trailing_comma
213
- assert_equal ( { } , parse ( '{}' , allow_trailing_comma : true ) )
214
- assert_equal ( { } , parse ( '{}' , allow_trailing_comma : false ) )
215
- assert_raise ( JSON ::ParserError ) { parse ( '{,}' , allow_trailing_comma : true ) }
216
- assert_raise ( JSON ::ParserError ) { parse ( '{,}' , allow_trailing_comma : false ) }
217
-
218
- assert_equal ( { 'foo' => 'bar' } , parse ( '{"foo":"bar"}' , allow_trailing_comma : true ) )
219
- assert_equal ( { 'foo' => 'bar' } , parse ( '{"foo":"bar"}' , allow_trailing_comma : false ) )
220
- assert_equal ( { 'foo' => 'bar' } , parse ( '{"foo":"bar",}' , allow_trailing_comma : true ) )
221
- assert_raise ( JSON ::ParserError ) { parse ( '{"foo":"bar",}' , allow_trailing_comma : false ) }
222
-
223
- assert_equal (
224
- { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
225
- parse ( '{"foo":"bar","baz":"qux","quux":"garply"}' , allow_trailing_comma : true )
226
- )
227
- assert_equal (
228
- { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
229
- parse ( '{"foo":"bar","baz":"qux","quux":"garply"}' , allow_trailing_comma : false )
230
- )
231
- assert_equal (
232
- { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
233
- parse ( '{"foo":"bar","baz":"qux","quux":"garply",}' , allow_trailing_comma : true )
234
- )
235
- assert_raise ( JSON ::ParserError ) {
236
- parse ( '{"foo":"bar","baz":"qux","quux":"garply",}' , allow_trailing_comma : false )
237
- }
238
-
239
- assert_equal (
240
- { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
241
- parse ( '{ "foo":"bar" , "baz":"qux" , "quux":"garply" }' , allow_trailing_comma : true )
242
- )
243
- assert_equal (
244
- { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
245
- parse ( '{ "foo":"bar" , "baz":"qux" , "quux":"garply" }' , allow_trailing_comma : false )
246
- )
247
- assert_equal (
248
- { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
249
- parse ( '{ "foo":"bar" , "baz":"qux" , "quux":"garply" , }' , allow_trailing_comma : true )
250
- )
251
- assert_raise ( JSON ::ParserError ) {
252
- parse ( '{ "foo":"bar" , "baz":"qux" , "quux":"garply" , }' , allow_trailing_comma : false )
253
- }
254
-
255
- assert_equal (
256
- [ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ] ,
257
- parse ( '[{"foo":"bar","baz":"qux","quux":"garply"}]' , allow_trailing_comma : true )
258
- )
259
- assert_equal (
260
- [ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ] ,
261
- parse ( '[{"foo":"bar","baz":"qux","quux":"garply"}]' , allow_trailing_comma : false )
262
- )
263
- assert_equal (
264
- [ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ] ,
265
- parse ( '[{"foo":"bar","baz":"qux","quux":"garply",}]' , allow_trailing_comma : true )
266
- )
267
- assert_raise ( JSON ::ParserError ) {
268
- parse ( '[{"foo":"bar","baz":"qux","quux":"garply",}]' , allow_trailing_comma : false )
269
- }
270
- end
213
+ assert_equal ( { } , parse ( '{}' , allow_trailing_comma : true ) )
214
+ assert_equal ( { } , parse ( '{}' , allow_trailing_comma : false ) )
215
+ assert_raise ( JSON ::ParserError ) { parse ( '{,}' , allow_trailing_comma : true ) }
216
+ assert_raise ( JSON ::ParserError ) { parse ( '{,}' , allow_trailing_comma : false ) }
217
+
218
+ assert_equal ( { 'foo' => 'bar' } , parse ( '{"foo":"bar"}' , allow_trailing_comma : true ) )
219
+ assert_equal ( { 'foo' => 'bar' } , parse ( '{"foo":"bar"}' , allow_trailing_comma : false ) )
220
+ assert_equal ( { 'foo' => 'bar' } , parse ( '{"foo":"bar",}' , allow_trailing_comma : true ) )
221
+ assert_raise ( JSON ::ParserError ) { parse ( '{"foo":"bar",}' , allow_trailing_comma : false ) }
222
+
223
+ assert_equal (
224
+ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
225
+ parse ( '{"foo":"bar","baz":"qux","quux":"garply"}' , allow_trailing_comma : true )
226
+ )
227
+ assert_equal (
228
+ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
229
+ parse ( '{"foo":"bar","baz":"qux","quux":"garply"}' , allow_trailing_comma : false )
230
+ )
231
+ assert_equal (
232
+ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
233
+ parse ( '{"foo":"bar","baz":"qux","quux":"garply",}' , allow_trailing_comma : true )
234
+ )
235
+ assert_raise ( JSON ::ParserError ) {
236
+ parse ( '{"foo":"bar","baz":"qux","quux":"garply",}' , allow_trailing_comma : false )
237
+ }
238
+
239
+ assert_equal (
240
+ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
241
+ parse ( '{ "foo":"bar" , "baz":"qux" , "quux":"garply" }' , allow_trailing_comma : true )
242
+ )
243
+ assert_equal (
244
+ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
245
+ parse ( '{ "foo":"bar" , "baz":"qux" , "quux":"garply" }' , allow_trailing_comma : false )
246
+ )
247
+ assert_equal (
248
+ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ,
249
+ parse ( '{ "foo":"bar" , "baz":"qux" , "quux":"garply" , }' , allow_trailing_comma : true )
250
+ )
251
+ assert_raise ( JSON ::ParserError ) {
252
+ parse ( '{ "foo":"bar" , "baz":"qux" , "quux":"garply" , }' , allow_trailing_comma : false )
253
+ }
254
+
255
+ assert_equal (
256
+ [ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ] ,
257
+ parse ( '[{"foo":"bar","baz":"qux","quux":"garply"}]' , allow_trailing_comma : true )
258
+ )
259
+ assert_equal (
260
+ [ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ] ,
261
+ parse ( '[{"foo":"bar","baz":"qux","quux":"garply"}]' , allow_trailing_comma : false )
262
+ )
263
+ assert_equal (
264
+ [ { 'foo' => 'bar' , 'baz' => 'qux' , 'quux' => 'garply' } ] ,
265
+ parse ( '[{"foo":"bar","baz":"qux","quux":"garply",}]' , allow_trailing_comma : true )
266
+ )
267
+ assert_raise ( JSON ::ParserError ) {
268
+ parse ( '[{"foo":"bar","baz":"qux","quux":"garply",}]' , allow_trailing_comma : false )
269
+ }
270
+ end
271
271
272
272
def test_parse_some_strings
273
273
assert_equal ( [ "" ] , parse ( '[""]' ) )
0 commit comments