Skip to content

Instantly share code, notes, and snippets.

@timo
Created April 9, 2015 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timo/ef1fa0ecf43f8ec0e3c8 to your computer and use it in GitHub Desktop.
Save timo/ef1fa0ecf43f8ec0e3c8 to your computer and use it in GitHub Desktop.
timo@schmetterling ~/p/e/json_fast (master) [41]> perl6 -Ilib t/01-parse.t
1..90
ok 1 - JSON string «{}» parsed
ok 2 - JSON string «{ }» parsed
ok 3 - JSON string « { } » parsed
ok 4 - JSON string «{ "a" : "b" }» parsed
ok 5 - JSON string «{ "a" : null }» parsed
ok 6 - JSON string «{ "a" : true }» parsed
ok 7 - JSON string «{ "a" : false }» parsed
ok 8 - JSON string «{ "a" : { } }» parsed
ok 9 - JSON string «[]» parsed
ok 10 - JSON string «[ ]» parsed
ok 11 - JSON string « [ ] » parsed
ok 12 - JSON string «[\n...[11]» parsed
ok 13 - JSON string «[1]» parsed
ok 14 - JSON string «[true]» parsed
ok 15 - JSON string «[-42]» parsed
ok 16 - JSON string «[-42,true,false,null]» parsed
ok 17 - JSON string «{ "integer": 1234567890 }» parsed
ok 18 - JSON string «{ "real": -9876.543210 }» parsed
ok 19 - JSON string «{ "e": 0.123456789e-12 }» parsed
ok 20 - JSON string «{ "E": 1.234567890E+34 }» parsed
ok 21 - JSON string «{ "": 23456789012E66 }» parsed
ok 22 - JSON string «{ "zero": 0 }» parsed
ok 23 - JSON string «{ "one": 1 }» parsed
ok 24 - JSON string «{ "space": " " }» parsed
# backslash sequences NYI
not ok 25 - JSON string «{ "quote": "\""}» parsed
# Failed test 'JSON string «{ "quote": "\""}» parsed'
# at t/01-parse.t line 210
# backslash sequences NYI
not ok 26 - JSON string «{ "backslash": "\\"}» parsed
# Failed test 'JSON string «{ "backslash": "\\"}» parsed'
# at t/01-parse.t line 210
# backslash sequences NYI
not ok 27 - JSON string «{ "controls": "\b\f\n\r\t"}» parsed
# Failed test 'JSON string «{ "controls": "\b\f\n\r\t"}» parsed'
# at t/01-parse.t line 210
# backslash sequences NYI
not ok 28 - JSON string «{ "slash": "/ & \/"}» parsed
# Failed test 'JSON string «{ "slash": "/ & \/"}» parsed'
# at t/01-parse.t line 210
ok 29 - JSON string «{ "alpha": "abcdefghijklmnopqrstuvwyz"}» parsed
ok 30 - JSON string «{ "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ"}» parsed
ok 31 - JSON string «{ "digit": "0123456789"}» parsed
ok 32 - JSON string «{ "0123456789": "digit"}» parsed
ok 33 - JSON string «{"special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?"}» parsed
# backslash sequences NYI
not ok 34 - JSON string «{"hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A"}» parsed
# Failed test 'JSON string «{"hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A"}» parsed'
# at t/01-parse.t line 210
ok 35 - JSON string «{"true": true}» parsed
ok 36 - JSON string «{"false": false}» parsed
ok 37 - JSON string «{"null": null}» parsed
ok 38 - JSON string «{"array":[ ]}» parsed
ok 39 - JSON string «{"object":{ }}» parsed
ok 40 - JSON string «{"address": "50 St. James Street"}» parsed
ok 41 - JSON string «{"url": "http://www.JSON.org/"}» parsed
ok 42 - JSON string «{"comment": "// /* <!-- --"}» parsed
ok 43 - JSON string «{"# -- --> */": " "}» parsed
ok 44 - JSON string «{ " s p a c e d " :[1,2 , 3\n...[43]» parsed
# backslash sequences NYI
not ok 45 - JSON string «{"jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}"}» parsed
# Failed test 'JSON string «{"jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}"}» parsed'
# at t/01-parse.t line 210
# backslash sequences NYI
not ok 46 - JSON string «{"quotes": "&#34; \u0022 %22 0x22 034 &#x22;"}» parsed
# Failed test 'JSON string «{"quotes": "&#34; \u0022 %22 0x22 034 &#x22;"}» parsed'
# at t/01-parse.t line 210
# backslash sequences NYI
not ok 47 - JSON string «{ "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"\n...[46]» parsed
# Failed test 'JSON string «{ "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"\n...[46]» parsed'
# at t/01-parse.t line 210
ok 48 - JSON string «[ 0.5 ,98.6\n...[47]» parsed
ok 49 - JSON string «[1e-1]» parsed
ok 50 - JSON string «[1e00,2e+00,2e-00,"rosebud"]» parsed
ok 51 - JSON string «[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]» parsed
# json requires object keys to be strings
not ok 52 - JSON string «{\n...[51]» parsed
# Failed test 'JSON string «{\n...[51]» parsed'
# at t/01-parse.t line 210
# json requires object keys to be strings
not ok 53 - JSON string «{\n...[52]» parsed
# Failed test 'JSON string «{\n...[52]» parsed'
# at t/01-parse.t line 210
# json requires object keys to be strings
not ok 54 - JSON string «{"menu": {\n...[53]» parsed
# Failed test 'JSON string «{"menu": {\n...[53]» parsed'
# at t/01-parse.t line 210
# json requires object keys to be strings
not ok 55 - JSON string «{"widget": {\n...[54]» parsed
# Failed test 'JSON string «{"widget": {\n...[54]» parsed'
# at t/01-parse.t line 210
ok 56 - NOT parsed «{ »
ok 57 - NOT parsed «{ 3 : 4 }»
ok 58 - NOT parsed «{ 3 : tru }»
ok 59 - NOT parsed «{ "a : false }»
ok 60 - NOT parsed «"A JSON payload should be an object or array, not a string."»
ok 61 - NOT parsed «{"Extra value after close": true} "misplaced quoted value"»
ok 62 - NOT parsed «{"Illegal expression": 1 + 2}»
ok 63 - NOT parsed «{"Illegal invocation": alert()}»
not ok 64 - NOT parsed «{"Numbers cannot have leading zeroes": 013}»
# Failed test 'NOT parsed «{"Numbers cannot have leading zeroes": 013}»'
# at t/01-parse.t line 224
ok 65 - NOT parsed «{"Numbers cannot be hex": 0x14}»
ok 66 - NOT parsed «["Illegal backslash escape: \x15"]»
ok 67 - NOT parsed «[\naked]»
ok 68 - NOT parsed «["Illegal backslash escape: \017"]»
ok 69 - NOT parsed «{"Missing colon" null}»
ok 70 - NOT parsed «["Unclosed array"»
ok 71 - NOT parsed «{"Double colon":: null}»
ok 72 - NOT parsed «{"Comma instead of colon", null}»
ok 73 - NOT parsed «["Colon instead of comma": false]»
ok 74 - NOT parsed «["Bad value", truth]»
ok 75 - NOT parsed «['single quote']»
ok 76 - NOT parsed «[" tab character in string "]»
ok 77 - NOT parsed «["line\n...[76]»
ok 78 - NOT parsed «["line\\n...[77]»
ok 79 - NOT parsed «[0e]»
ok 80 - NOT parsed «{unquoted_key: "keys must be quoted"}»
ok 81 - NOT parsed «[0e+]»
ok 82 - NOT parsed «[0e+-1]»
ok 83 - NOT parsed «{"Comma instead if closing brace": true,»
ok 84 - NOT parsed «["mismatch"}»
ok 85 - NOT parsed «["extra comma",]»
ok 86 - NOT parsed «["double extra comma",,]»
ok 87 - NOT parsed «[ , "<-- missing value"]»
ok 88 - NOT parsed «["Comma after the close"],»
ok 89 - NOT parsed «["Extra close"]]»
ok 90 - NOT parsed «{"Extra comma": true,}»
# Looks like you failed 13 tests of 90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment