--- parser3/tests/253.html 2010/09/02 22:56:09 1.2 +++ parser3/tests/253.html 2024/09/10 19:32:10 1.9 @@ -1,53 +1,46 @@ @main[] -$f[^file::load[text;253_json.txt]] +$f[^file::load[text;253_json.txt; $.charset[windows-1251]]] $s[^taint[as-is][$f.text]] -^try_catch{$o[^json:parse[$s]]} +^try-catch{$o[^json:parse[$s; $.array[hash] ]]} -$o[^json:parse[$s][ $.distinct[first] ]] -^print[$o] +^test[$s][ $.object[$hook] $.distinct[first] ] -$o[^json:parse[$s][ $.double(false) $.distinct[last] ]] -^print[$o] +^test[$s][ $.double(false) $.distinct[last] ] -$o[^json:parse[$s][ $.object[$hook] $.distinct[all] ]] -^print[$o] +^test[$s][ $.int(false) $.distinct[last] ] + +^test[$s][ $.object[$hook_key] $.distinct[all] ] + +$s[[1,{"type":"class1","value":"3"},4]] + +^test[$s][ $.object[$hook] ] -@try_catch[code] -^try{ - $code -}{ - $exception.handled(true) - $exception.source - $exception.comment -} +^test[$s] + +@test[s;options] +$o[^json:parse[$s][ $options $.array[hash] ]] +^print[$o] @print[hash] -^hash.foreach[k;v]{ - $k = ^if($v is 'hash'){{^print[$v] - }}{ - $v.CLASS_NAME ^if($v is 'bool'){ ^if($v){true}{false} }($v is 'class1' || $v is 'class2'){^v.print[]}{$v} - } -} +$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[$h.value] - -@print[] -value "$value" +$value[class1 $h.value] @CLASS class2 @create[h] -$value[$h.value] - -@print[] -value "$value" +$value[class2 $h.value]