Results for ysh-json.test.sh

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

Details on runs that didn't PASS

osh25 JSON \/ escapes supported

[osh stdout] Expected '/\nreply=/\nreply=/\n', got 'reply=/\nreply=/\n'

stdout:
reply=/
reply=/
stderr:
  echo "$msg" | python3 -c 'import json, sys; print(json.load(sys.stdin))'
                ^~~~~~~
[ stdin ]:3: 'python3' not found (OILS-ERR-100)
osh_ALT25 JSON \/ escapes supported

[osh_ALT stdout] Expected '/\nreply=/\nreply=/\n', got 'reply=/\nreply=/\n'

stdout:
reply=/
reply=/
stderr:
  echo "$msg" | python3 -c 'import json, sys; print(json.load(sys.stdin))'
                ^~~~~~~
[ stdin ]:3: 'python3' not found (OILS-ERR-100)
osh27 J8 supports superfluous \" escapes, but JSON doesn't support \' escapes

[osh stdout] Expected 'reply="\n(Str) "\'\'\\b\\f\\n\\r\\t\\"\\\\"\npython3=1\njson=1\n' Got 'reply="\n(Str) "\'\'\\b\\f\\n\\r\\t\\"\\\\"\npython3=127\njson=1\n'

stdout:
reply="
(Str)   "''\b\f\n\r\t\"\\"
python3=127
json=1
stderr:
  json read <<'EOF'
       ^~~~
[ stdin ]:16: json read: Bad backslash escape in JSON string (line 1, offset 0-2: '"\\\'"\n')
osh_ALT27 J8 supports superfluous \" escapes, but JSON doesn't support \' escapes

[osh_ALT stdout] Expected 'reply="\n(Str) "\'\'\\b\\f\\n\\r\\t\\"\\\\"\npython3=1\njson=1\n' Got 'reply="\n(Str) "\'\'\\b\\f\\n\\r\\t\\"\\\\"\npython3=127\njson=1\n'

stdout:
reply="
(Str)   "''\b\f\n\r\t\"\\"
python3=127
json=1
stderr:
  json read <<'EOF'
       ^~~~
[ stdin ]:16: json read: Bad backslash escape in JSON string (line 1, offset 0-2: '"\\\'"\n')
osh46 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
osh_ALT46 Inf and NaN can't be encoded or decoded

[osh_ALT status] Expected 2, got 3

stdout:
stderr: 
  var n = float("NaN")
                ^
[ stdin ]:1: fatal: Cannot convert NaN to Float
osh53 round trip: read/write with ysh, read/write with Python 3 (bug regression)

[osh stdout] Expected 'diff=0\n', got '--- /home/uke/oil/spec/testdata/bug.json\t2024-07-03 13:41:07.736805699 +0000\n+++ py-json\t2024-07-03 13:46:51.575010512 +0000\n@@ -1,25 +0,0 @@\n-{\n- "files": {\n- "etc": {},\n- "sw": {}\n- },\n- "modules": {\n- "mergePath": {\n- "enable": true\n- },\n- "shareNftables": {\n- "enable": true\n- },\n- "shareSystemd": {\n- "enable": true,\n- "replace": [],\n- "units": [\n- "nftables.service",\n- "nix-unify-at-boot.service"\n- ]\n- },\n- "useNixDaemon": {\n- "enable": true\n- }\n- }\n-}\ndiff=1\n'

stdout:
--- /home/uke/oil/spec/testdata/bug.json	2024-07-03 13:41:07.736805699 +0000
+++ py-json	2024-07-03 13:46:51.575010512 +0000
@@ -1,25 +0,0 @@
-{
-  "files": {
-    "etc": {},
-    "sw": {}
-  },
-  "modules": {
-    "mergePath": {
-      "enable": true
-    },
-    "shareNftables": {
-      "enable": true
-    },
-    "shareSystemd": {
-      "enable": true,
-      "replace": [],
-      "units": [
-        "nftables.service",
-        "nix-unify-at-boot.service"
-      ]
-    },
-    "useNixDaemon": {
-      "enable": true
-    }
-  }
-}
diff=1
stderr:
  cat ysh-json | python3 -c \
                 ^~~~~~~
[ stdin ]:5: 'python3' not found (OILS-ERR-100)
osh_ALT53 round trip: read/write with ysh, read/write with Python 3 (bug regression)

[osh_ALT stdout] Expected 'diff=0\n', got '--- /home/uke/oil/test/../spec/testdata/bug.json\t2024-07-03 13:41:07.736805699 +0000\n+++ py-json\t2024-07-03 13:46:51.627010789 +0000\n@@ -1,25 +0,0 @@\n-{\n- "files": {\n- "etc": {},\n- "sw": {}\n- },\n- "modules": {\n- "mergePath": {\n- "enable": true\n- },\n- "shareNftables": {\n- "enable": true\n- },\n- "shareSystemd": {\n- "enable": true,\n- "replace": [],\n- "units": [\n- "nftables.service",\n- "nix-unify-at-boot.service"\n- ]\n- },\n- "useNixDaemon": {\n- "enable": true\n- }\n- }\n-}\ndiff=1\n'

stdout:
--- /home/uke/oil/test/../spec/testdata/bug.json	2024-07-03 13:41:07.736805699 +0000
+++ py-json	2024-07-03 13:46:51.627010789 +0000
@@ -1,25 +0,0 @@
-{
-  "files": {
-    "etc": {},
-    "sw": {}
-  },
-  "modules": {
-    "mergePath": {
-      "enable": true
-    },
-    "shareNftables": {
-      "enable": true
-    },
-    "shareSystemd": {
-      "enable": true,
-      "replace": [],
-      "units": [
-        "nftables.service",
-        "nix-unify-at-boot.service"
-      ]
-    },
-    "useNixDaemon": {
-      "enable": true
-    }
-  }
-}
diff=1
stderr:
  cat ysh-json | python3 -c \
                 ^~~~~~~
[ stdin ]:5: 'python3' not found (OILS-ERR-100)