Results for ysh-json.test.sh

statusosh
pass 52
FAIL 2
total54
caseoshdescription
0pass usage errors
1pass json write STRING
2pass json write ARRAY
3pass json write Dict
4pass json write compact format
5pass json write in command sub
6pass json read passed invalid args
7pass json read uses $_reply var
8pass json read then json write
9pass json read with redirect
10pass json read at end of pipeline (relies on lastpipe)
11pass invalid JSON
12pass Extra data after valid JSON
13pass json write expression
14pass json write evaluation error
15pass json write of List in cycle
16pass json write of Dict in cycle
17pass json write of List/Dict referenced twice (bug fix)
18pass json read doesn't accept u'' or b'' strings
19pass json read doesn't accept comments, but json8 does
20pass json write emits Unicode replacement char for binary data \yff
21pass json8 write emits b'' strings for binary data \yff
22pass json8 write bytes vs unicode string
23pass JSON \/ escapes supported
24pass JSON string can have unescaped ' and J8 string can have unescaped "
25pass J8 supports superfluous \" escapes, but JSON doesn't support \' escapes
26pass Escaping uses \u0001 in "", but \u{1} in b''
27pass json8 read
28pass json8 round trip
29pass json round trip (regression)
30pass round trip: decode surrogate pair and encode
31FAIL round trip: decode surrogate half and encode
details
32pass toJson() toJson8() - TODO: test difference
33pass fromJson() fromJson8() - TODO: test difference
34pass User can handle errors - toJson() toJson8()
35pass User can handle errors - fromJson() fromJson8()
36pass ASCII control chars can't appear literally in messages
37pass \yff can't appear in u'' code strings (command)
38pass \yff can't appear in u'' code strings (expr)
39pass \yff can't appear in u'' multiline code strings
40pass \yff can't appear in u'' data strings
41pass \u{dc00} can't be in surrogate range in code (command)
42pass \u{dc00} can't be in surrogate range in code (expr)
43pass \u{dc00} can't be in surrogate range in data
44FAIL Inf and NaN can't be encoded or decoded
details
45pass Invalid UTF-8 in JSON is rejected
46pass Invalid JSON in J8 is rejected
47pass '' means the same thing as u''
48pass decode deeply nested structure (stack overflow)
49pass decode integer larger than 2^32
50pass round trip: read/write with ysh
51pass round trip: read/write with ysh, read/write with Python 3 (bug regression)
52pass Encoding bytes that don't hit UTF8_REJECT immediately (bug fix)
53pass NIL8 token in JSON / JSON8
52 passed, 0 OK, 0 not implemented, 0 BUG, 2 failed, 0 timeouts, 0 cases skipped
2 failed under osh

Details on runs that didn't PASS

osh31 round trip: decode surrogate half and encode

[osh stdout] Expected '(Str) b\'\\ya0\\ybe\'\n"\\ud83e"\n(Str) b\'\\yb4\\ya6\'\n"\\udd26"\n' Got '(Str) b\'\\yed\\ya0\\ybe\'\n"\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd"\n(Str) b\'\\yed\\yb4\\ya6\'\n"\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd"\n'

stdout:
(Str)   b'\yed\ya0\ybe'
"���"
(Str)   b'\yed\yb4\ya6'
"���"
stderr:
osh44 Inf and NaN can't be encoded or decoded

[osh status] Expected 2, got 3

stdout:
stderr: 
  var n = float("NaN")
                ^
[ stdin ]:1: fatal: Cannot convert NaN to Float