File:  [parser3project] / parser3 / tests / 253.html
Revision 1.10: download - view: text, annotated - select for diffs - revision graph
Wed Oct 2 20:06:47 2024 UTC (19 months, 3 weeks ago) by moko
Branches: MAIN
CVS tags: release_3_5_1, release_3_5_0, HEAD
more tests for full array and json code coverage

@main[]

$f[^file::load[text;253_json.txt; $.charset[windows-1251]]]
$s[^taint[as-is][$f.text]]

^try-catch{$o[^json:parse[$s; $.array[hash] ]]}

^try-catch{$o[^json:parse[$s; $.depth(2) ]]}

^try-catch{$o[^json:parse[$s; $.distinct[bug] ]]}

^test[$s][ $.object[$hook] $.distinct[first] ]

^test[$s][ $.double(false) $.distinct[last] ]

^test[$s][ $.int(false) $.distinct[last] ]

^test[$s][ $.object[$hook_key] $.distinct[all] ]

$s[[1,{"type":"class1","value":"3"},4]]

^test[$s][ $.object[$hook] ]

^test[$s]

@test[s;options]
$o[^json:parse[$s][ $options $.array[hash] ]]
^print[$o]

@print[hash]
$result[^json:string[$hash; $.indent(1)]]
$result[^result.replace[e+0;e+]]

@hook[key;value]
$result[^if(def $value.type){^reflection:create[$value.type;create;$value]}{$value}]

@hook_key[key;value]
$result[^if($key eq 'object'){^reflection:create[$value.type;create;$value]}{$value}]

@CLASS
class1

@create[h]
$value[class1 $h.value]

@CLASS
class2

@create[h]
$value[class2 $h.value]

E-mail: