*** Running test-ascii-control

===== CASE: -c echo $'\x02' | json read =====


  echo $'\x02' | json read
                      ^~~~
[ -c flag ]:1: json read: Invalid token while parsing JSON: Id.Unknown_Tok (line 1, offset 0-1: '\x02\n')

===== CASE: -c echo $'"foo \x01 "' | json read
pp test_ (_reply) =====


  echo $'"foo \x01 "' | json read
                             ^~~~
[ -c flag ]:1: json read: JSON strings can't have unescaped ASCII control chars (line 1, offset 0-6: '"foo \x01 "\n')
  echo $'"foo \x01 "' | json read
                        ^~~~
[ -c flag ]:1: errexit PID 8053: command.Simple failed with status 1
  echo $'"foo \x01 "' | json read
                        ^~~~
[ -c flag ]:1: errexit PID 8053: command.Pipeline failed with status 1

===== CASE: -c var invalid = b'\y01'
echo $["u'foo" ++ invalid ++ "'"] | json8 read
pp test_ (_reply) =====


  echo $["u'foo" ++ invalid ++ "'"] | json8 read
                                            ^~~~
[ -c flag ]:2: json8 read: J8 strings can't have unescaped ASCII control chars (line 1, offset 0-6: "u'foo\x01'\n")
  echo $["u'foo" ++ invalid ++ "'"] | json8 read
                                      ^~~~~
[ -c flag ]:2: errexit PID 8058: command.Simple failed with status 1
  echo $["u'foo" ++ invalid ++ "'"] | json8 read
                                      ^~~~~
[ -c flag ]:2: errexit PID 8058: command.Pipeline failed with status 1
OK  test-ascii-control
*** Running test-cpython
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 1 column 6 (char 5)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
OK  test-cpython
*** Running test-encode

===== CASE: -c var d = {}; setvar d.k = d; json write (d) =====


[ -c flag ]:1: json write: Can't encode Dict 0x7f9c6910f710 in object cycle

===== CASE: -c var L = []; call L->append(L); json write (L) =====


[ -c flag ]:1: json write: Can't encode List 0x7fd5d1778710 in object cycle

===== CASE: -c var L = []; call L->append(/d+/); j8 write (L) =====


  var L = []; call L->append(/d+/); j8 write (L)
                                             ^
[ -c flag ]:1: fatal: 'j8' appears to be external. External commands don't accept typed args (OILS-ERR-200)
OK  test-encode
*** Running test-j8-lines

===== CASE: -c write @(echo ' "json\tstring"  '; echo; echo " b'j8' "; echo ' unquoted ';) =====