-
Notifications
You must be signed in to change notification settings - Fork 1
/
rjson-test.bmx
742 lines (667 loc) · 21.3 KB
/
rjson-test.bmx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
'test for rjson2.bmx
' derived from tests in the jsonlint github project
SuperStrict
Import twrc.rjson
Global test_dir$ = "test"
'var fs = require("fs"),
'' assert = require("assert"),
'' parser = require("../lib/jsonlint").parser;
json.formatted = False
json.empty_container_as_null = True
Function test_object()
Print "*** test_object"
Local json_str$ = "{~qfoo~q: ~qbar~q}"
Local val:TString = New TString
val.value = "bar"
Local obj:TObject = New TObject
obj.fields.Insert( "foo", val )
Local json_obj:TValue = TValue( json.parse( json_str ))
verify( json_obj.Equals( obj ), json_obj.ToString()+"~n"+obj.ToString() )
EndFunction
Function test_escaped_backslash()
Print "*** test_escaped_backslash"
Local json_str$ = "{~qfoo~q: ~q\\~q}"
Local val:TString = New TString
val.value = "\"
Local obj:TObject = New TObject
obj.fields.Insert( "foo", val )
Local json_obj:TValue = TValue( json.parse( json_str ))
verify( json_obj.Equals( obj ), json_obj.ToString()+"~n"+obj.ToString() )
EndFunction
Function test_escaped_chars()
Print "*** test_escaped_chars"
Local json_str$ = "{~qfoo~q: ~q\\\\\\\~q~q}"
Local val:TString = New TString
val.value = "\\\~q"
Local obj:TObject = New TObject
obj.fields.Insert( "foo", val )
Local json_obj:TValue = TValue( json.parse( json_str ))
verify( json_obj.Equals( obj ), json_obj.ToString()+"~n"+obj.ToString() )
EndFunction
Function test_escaped_newline()
Print "*** test_escaped_newline"
Local json_str$ = "{~qfoo~q: ~q\\\n~q}"
Local val:TString = New TString
val.value = "\~n"
Local obj:TObject = New TObject
obj.fields.Insert( "foo", val )
Local json_obj:TValue = TValue( json.parse( json_str ))
verify( json_obj.Equals( obj ), json_obj.ToString()+"~n"+obj.ToString() )
EndFunction
Function test_string_with_escaped_line_break()
Print "*** test_string_with_escaped_line_break"
Local json_str$ = "{~qfoo~q:~qbar\nbar~q}"
Local val:TString = New TString
val.value = "bar~nbar"
Local obj:TValue = New TObject
TObject(obj).fields.Insert( "foo", val )
Local json_obj:TValue = TValue( json.parse( json_str ))
verify( json_obj.Equals( obj ), json_obj.ToString()+"~n"+obj.ToString() )
Local json_str_roundtrip$ = json.stringify( json_obj )
verify( json_str_roundtrip = json_str, json_str+"~n"+json_str_roundtrip )
EndFunction
Function test_string_with_line_break()
Print "*** test_string_with_line_break"
Local json_str$ = "{~qfoo~q: ~qbar~nbar~q}"
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_string_literal()
Print "*** test_string_literal"
Local json_str$ = "~qfoo~q"
Local val:TString = New TString; val.value = "foo";
verify( val.Equals( json.parse( json_str )) )
EndFunction
Function test_number_literal()
Print "*** test_number_literal"
Local json_str$ = "1234"
Local val:TNumber = New TNumber; val.value = 1234;
verify( val.Equals( json.parse( json_str )) )
EndFunction
Function test_number_literal2()
Print "*** test_number_literal with trailing f"
Local json_str$ = "1234.0f"
Local val:TNumber = New TNumber; val.value = 1234;
verify( val.Equals( json.parse( json_str )) )
EndFunction
Function test_number_literal3()
Print "*** test_number_literal starting with decimal point"
Local json_str$ = ".8"
Local test_val:TNumber = New TNumber
test_val.value = 0.8;
Local decoded_val:TNumber = TNumber( json.parse( json_str ))
Local test_val_str$ = json.FormatDouble( test_val.value )
Local decoded_val_str$ = json.FormatDouble( decoded_val.value )
verify( test_val_str = decoded_val_str, ""+test_val_str+" <> "+decoded_val_str )
EndFunction
Function test_null_literal()
Print "*** test_null_literal"
Local json_str$ = "null"
Local val:TNull = New TNull
verify( val.Equals( json.parse( json_str )) )
EndFunction
Function test_boolean_literal()
Print "*** test_boolean_literal"
Local json_str$ = "true"
Local val:TBoolean = New TBoolean; val.value = True
verify( val.Equals( json.parse( json_str )) )
EndFunction
Function test_unclosed_array()
Print "*** test_unclosed_array"
Local json_str$ = LoadString( test_dir + "/fails/2.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_unquotedkey_keys_must_be_quoted()
Print "*** test_unquotedkey_keys_must_be_quoted"
Local json_str$ = LoadString( test_dir + "/fails/3.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_extra_comma()
Print "*** test_extra_comma"
Local json_str$ = LoadString( test_dir + "/fails/4.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_double_extra_comma()
Print "*** test_double_extra_comma"
Local json_str$ = LoadString( test_dir + "/fails/5.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_missing_value()
Print "*** test_missing_value"
Local json_str$ = LoadString( test_dir + "/fails/6.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_comma_after_the_close()
Print "*** test_comma_after_the_close"
Local json_str$ = LoadString( test_dir + "/fails/7.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_extra_close()
Print "*** test_extra_close"
Local json_str$ = LoadString( test_dir + "/fails/8.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_extra_comma_after_value()
Print "*** test_extra_comma_after_value"
Local json_str$ = LoadString( test_dir + "/fails/9.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_extra_value_after_close_with_misplaced_quotes()
Print "*** test_extra_value_after_close_with_misplaced_quotes"
Local json_str$ = LoadString( test_dir + "/fails/10.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_illegal_expression_addition()
Print "*** test_illegal_expression_addition"
Local json_str$ = LoadString( test_dir + "/fails/11.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_illegal_invocation_of_alert()
Print "*** test_illegal_invocation_of_alert"
Local json_str$ = LoadString( test_dir + "/fails/12.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_numbers_cannot_have_leading_zeroes()
Print "*** test_numbers_cannot_have_leading_zeroes"
Local json_str$ = LoadString( test_dir + "/fails/13.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_numbers_cannot_be_hex()
Print "*** test_numbers_cannot_be_hex"
Local json_str$ = LoadString( test_dir + "/fails/14.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_illegal_backslash_escape_null()
Print "*** test_illegal_backslash_escape_null"
Local json_str$ = LoadString( test_dir + "/fails/15.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_unquoted_text()
Print "*** test_unquoted_text"
Local json_str$ = LoadString( test_dir + "/fails/16.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_illegal_backslash_escape_sequence()
Print "*** test_illegal_backslash_escape_sequence"
Local json_str$ = LoadString( test_dir + "/fails/17.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_missing_colon()
Print "*** test_missing_colon"
Local json_str$ = LoadString( test_dir + "/fails/19.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_double_colon()
Print "*** test_double_colon"
Local json_str$ = LoadString( test_dir + "/fails/20.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_comma_instead_of_colon()
Print "*** test_comma_instead_of_colon"
Local json_str$ = LoadString( test_dir + "/fails/21.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_colon_instead_of_comma()
Print "*** test_colon_instead_of_comma"
Local json_str$ = LoadString( test_dir + "/fails/22.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_bad_raw_value()
Print "*** test_bad_raw_value"
Local json_str$ = LoadString( test_dir + "/fails/23.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_single_quotes()
Print "*** test_single_quotes"
Local json_str$ = LoadString( test_dir + "/fails/24.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_tab_character_in_string()
Print "*** test_tab_character_in_string"
Local json_str$ = LoadString( test_dir + "/fails/25.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_tab_character_in_string_2()
Print "*** test_tab_character_in_string_2"
Local json_str$ = LoadString( test_dir + "/fails/26.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_line_break_in_string()
Print "*** test_line_break_in_string"
Local json_str$ = LoadString( test_dir + "/fails/27.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_line_break_in_string_in_array()
Print "*** test_line_break_in_string_in_array"
Local json_str$ = LoadString( test_dir + "/fails/28.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_0e()
Print "*** test_0e"
Local json_str$ = LoadString( test_dir + "/fails/29.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_0e_()
Print "*** test_0e_"
Local json_str$ = LoadString( test_dir + "/fails/30.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_0e__1()
Print "*** test_0e__1"
Local json_str$ = LoadString( test_dir + "/fails/31.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_comma_instead_of_closing_brace()
Print "*** test_comma_instead_of_closing_brace"
Local json_str$ = LoadString( test_dir + "/fails/32.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_bracket_mismatch()
Print "*** test_bracket_mismatch"
Local json_str$ = LoadString( test_dir + "/fails/33.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_extra_brace()
Print "*** test_extra_brace"
Local json_str$ = LoadString( test_dir + "/fails/34.json" )
Try
json.parse( json_str )
Catch ex$
Return
EndTry
verify( False, " should throw error" )
EndFunction
Function test_pass_1()
Print "*** test_pass_1"
Local json_str$ = LoadString( test_dir + "/passes/1.json" )
json.parse( json_str )
EndFunction
Function test_pass_2()
Print "*** test_pass_2"
Local json_str$ = LoadString( test_dir + "/passes/2.json" )
json.parse( json_str )
EndFunction
Function test_pass_3()
Print "*** test_pass_3"
Local json_str$ = LoadString( test_dir + "/passes/3.json" )
json.parse( json_str )
EndFunction
Type type_1_simple
Field in1:Int
Field st1:String
Field st2:String
EndType
Type type_2_complex
Field by:Byte
Field sh:Short
Field in:Int
Field lo:Long
Field fl:Float
Field do:Double
Field t1:type_1_simple
Field byArr:Byte[]
Field stArr:String[]
EndType
Function test_map_object_to_tvalue()
Print "*** test_map_object_to_tvalue"
Local obj:type_1_simple = New type_1_simple
obj.in1 = 75
obj.st1 = "stri~qng1~q"
obj.st2 = "string2"
Local obj2:type_2_complex = New type_2_complex
obj2.by = 128
obj2.sh = 1280
obj2.in = 1457428982
obj2.lo = -2038719820
obj2.fl = 3848.5
obj2.do = 2.9999994999
obj2.t1 = obj
obj2.byArr = [ 24:Byte, 1:Byte, 99:Byte ]
obj2.stArr = [ "s1", "~n", "~t", "\" ]
Local json_str$ = json.stringify( obj2 )
Local test_str$ = "{~qby~q:128,~qbyArr~q:[24,1,99],~qdo~q:3,~qfl~q:3848.5,~qin~q:1457428982,~qlo~q:-2038719820,~qsh~q:1280,~qstArr~q:[~qs1~q,~q\n~q,~q\t~q,~q\\~q],~qt1~q:{~qin1~q:75,~qst1~q:~qstri\~qng1\~q~q,~qst2~q:~qstring2~q}}"
verify( json_str = test_str, test_str+"~n"+json_str )
EndFunction
Function test_map_tvalue_to_object()
Print "*** test_map_tvalue_to_object"
Local obj2:type_2_complex
Local json_str$ = "{~qby~q:128,~qbyArr~q:[24,1,99],~qdo~q:3,~qfl~q:3848.5,~qin~q:1457428982,~qlo~q:-2038719820,~qsh~q:1280,~qstArr~q:[~qs1~q,~q\n~q,~q\t~q,~q\\~q],~qt1~q:{~qin1~q:75,~qst1~q:~qstri\~qng1\~q~q,~qst2~q:~qstring2~q}}"
obj2 = type_2_complex( json.parse( json_str, "type_2_complex" ))
Local roundtrip_str$ = json.stringify( obj2 )
verify( json_str = roundtrip_str, " ORIGINAL: "+json_str+"~n ROUNDTRIP: "+roundtrip_str )
EndFunction
Function test_pass_starfarer()
Print "*** test_pass_starfarer"
Local json_str$ = LoadString( test_dir + "/passes/starfarer.json" )
Local decoded:Object = json.parse( json_str )
verify( ..
TObject(decoded).fields.ValueForKey( "enum1" ).ToString() = "ENUM_VALUE", ..
"ENUM_VALUE <> "+TObject(decoded).fields.ValueForKey( "enum1" ).ToString() )
EndFunction
Function test_encode_TList()
Print "*** test_encode_TList"
Local list:TList = CreateList()
list.AddLast( "string1" )
list.AddLast( "string2" )
list.AddLast( "string3" )
Local json_str$ = json.stringify( list )
Local test_str$ = "[~qstring1~q,~qstring2~q,~qstring3~q]"
verify( test_str = json_str, test_str+"~n"+json_str )
EndFunction
Function test_encode_TMap()
Print "*** test_encode_TMap"
Local map:TMap = CreateMap()
map.Insert( "key1", "string1" )
map.Insert( "key2", "string2" )
map.Insert( "key3", "string3" )
Local json_str$ = json.stringify( map )
Local test_str$ = "{~qkey1~q:~qstring1~q,~qkey2~q:~qstring2~q,~qkey3~q:~qstring3~q}"
verify( test_str = json_str, test_str+"~n"+json_str )
EndFunction
Function test_tvalue_transformation_search()
Print "*** test_tvalue_transformation_search"
Local json_str$ = LoadString( test_dir + "/passes/xf1_in.json" )
Local val:TValue = TValue( json.parse( json_str ))
Local xf:TValue_Transformation = TValue_Transformation.Create( ..
":string", json.XJ_DELETE, Null, Null )
Local results:TList = xf.Search( val )
Local json_out_expected$ = LoadString( test_dir + "/passes/xf1_out.json" )
Local json_out_actual$ = json.stringify( results )
verify( json_out_expected = json_out_actual, " EXPECTED:~n"+json_out_expected+"~n ACTUAL:~n"+json_out_actual )
EndFunction
Function test_tvalue_transformation_conditional_delete()
rem
Print "*** test_tvalue_transformation_conditional_delete"
Local json_str$ = LoadString( test_dir + "/passes/xf2_in.json" )
json.add_transform( "parse", ":object/$ALPHA:string", json.XJ_DELETE )
json.add_transform( "parse", "@4:number", json.XJ_DELETE )
json.add_transform( "parse", "@5:boolean", json.XJ_DELETE )
json.add_transform( "parse", ":object/:boolean", json.XJ_DELETE,, __TBoolean_NOT )
Local val:TValue = TValue( json.parse( json_str,, "parse" ))
verify( TObject(TArray( val ).elements.ValueAtIndex(8)).fields.Contains("ALPHA") = False, "value should not be found" )
json.clear_transforms()
endrem
EndFunction
Function __TBoolean_NOT%( val:TValue )
If TBoolean(val) Then Return (Not TBoolean(val).value) ..
Else Return False
EndFunction
Function test_pass_sf_1()
Print "*** test_pass_sf_1"
Local json_str$ = LoadString( test_dir + "/passes/sfw1.json" )
json.parse( json_str )
EndFunction
Function test_pass_sf_2()
Print "*** test_pass_sf_2"
Local json_str$ = LoadString( test_dir + "/passes/sfw2.json" )
json.parse( json_str )
EndFunction
Type type_3_containers
Field str$
Field arr%[]
Field obj:type_3_containers
EndType
Function test_encode_empty_objects_instead_of_nulls()
Print "*** test_encode_empty_objects_instead_of_nulls"
Local obj:type_3_containers = New type_3_containers
Local json_str$
Local test_str$
json.empty_container_as_null = False
json_str = json.stringify( obj )
test_str = "{~qarr~q:[],~qobj~q:{},~qstr~q:~q~q}"
verify( test_str = json_str, " EXPECTED:~n"+test_str+"~n ACTUAL:~n"+json_str )
json.empty_container_as_null = True
json_str = json.stringify( obj )
test_str = "{~qarr~q:null,~qobj~q:null,~qstr~q:null}"
verify( test_str = json_str, " EXPECTED:~n"+test_str+"~n ACTUAL:~n"+json_str )
EndFunction
Function bug1()
'Print "*** reported bug 1"
'Local json_str$ = LoadString( test_dir + "/passes/bug1.json" )
'Local val:Object = json.parse( json_str )
'Local check:TNumber = TNumber(TObject(TObject(val).Get("exigencyEngine")).Get("contrailMaxSpeedMult"))
'Local expected:Double = 0.1:Double
'verify( expected = check.value, " EXPECTED: "+expected+" ACTUAL: "+check.value )
EndFunction
'/////////////////////////////////////////////////////////////////
Function calc_hash%(s:String)
Local hc% = 0
Local l% = Len(s)
For Local i% = 0 To l
hc = hc * 131 + Asc(Right(s,l-i))
Next
hc = Abs(hc)
Return hc
EndFunction
Function verify( boolean_expression%, error_str$="" )
If Not boolean_expression
Throw " TEST FAILED~n"+error_str
EndIf
EndFunction
Function run_test( test_function() )
Try
test_function()
Catch ex$
Print ex
EndTry
EndFunction
Function Main()
run_test( test_object )
run_test( test_escaped_backslash )
run_test( test_escaped_chars )
run_test( test_escaped_newline )
run_test( test_string_with_escaped_line_break )
run_test( test_string_with_line_break )
run_test( test_string_literal )
run_test( test_number_literal )
run_test( test_number_literal2 )
run_test( test_number_literal3 )
run_test( test_null_literal )
run_test( test_boolean_literal )
run_test( test_unclosed_array )
'run_test( test_unquotedkey_keys_must_be_quoted ) 'I explicitly allow unquoted strings as long as they use [_a-zA-Z0-9]+
'run_test( test_extra_comma ) 'I explicitly choose to accept: a single trailing comma (ARRAY)
run_test( test_double_extra_comma )
run_test( test_missing_value )
run_test( test_comma_after_the_close )
run_test( test_extra_close )
'run_test( test_extra_comma_after_value ) 'I explicitly choose to accept: a single trailing comma (OBJECT)
run_test( test_extra_value_after_close_with_misplaced_quotes )
run_test( test_illegal_expression_addition )
'run_test( test_illegal_invocation_of_alert ) 'Doesn't apply here; not Javascript
'run_test( test_numbers_cannot_have_leading_zeroes ) 'I accept leading zeroes because Blitzmax does
run_test( test_numbers_cannot_be_hex )
run_test( test_illegal_backslash_escape_null )
run_test( test_unquoted_text )
run_test( test_illegal_backslash_escape_sequence )
run_test( test_missing_colon )
run_test( test_double_colon )
run_test( test_comma_instead_of_colon )
run_test( test_colon_instead_of_comma )
'run_test( test_bad_raw_value ) 'Bad Raw Values are indistinguishable from unquoted strings
run_test( test_single_quotes )
run_test( test_tab_character_in_string )
run_test( test_tab_character_in_string_2 )
run_test( test_line_break_in_string )
run_test( test_line_break_in_string_in_array )
run_test( test_0e )
run_test( test_0e_ )
run_test( test_0e__1 )
run_test( test_comma_instead_of_closing_brace )
run_test( test_bracket_mismatch )
run_test( test_extra_brace )
run_test( test_pass_1 )
run_test( test_pass_2 )
run_test( test_pass_3 )
run_test( test_map_object_to_tvalue )
run_test( test_map_tvalue_to_object )
run_test( test_pass_starfarer )
run_test( test_encode_TList )
run_test( test_encode_TMap )
run_test( test_tvalue_transformation_search )
run_test( test_tvalue_transformation_conditional_delete )
run_test( test_pass_sf_1 )
run_test( test_pass_sf_2 )
run_test( test_encode_empty_objects_instead_of_nulls )
run_test( bug1 )
EndFunction
Main()