*** Running test-EvalExpr-calls

===== CASE: json write (len(42)) =====


  json write (len(42))
  ^~~~
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: = len(42) =====


  = len(42)
  ^
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: _ len(42) =====


  _ len(42)
  ^
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: echo $[len(42)] =====


  echo $[len(42)]
  ^~~~
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: echo $len(42) =====


  echo $len(42)
  ^~~~
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: echo $len(z = 42) =====


  echo $len(z = 42)
  ^~~~
[ -c flag ]:1: fatal: Type error in expression: len() takes no keyword arguments

===== CASE: echo @len(42) =====


  echo @len(42)
  ^~~~
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: echo @len(z = 42) =====


  echo @len(z = 42)
  ^~~~
[ -c flag ]:1: fatal: Type error in expression: len() takes no keyword arguments

===== CASE: const x = len(42) =====


  const x = len(42)
        ^
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: setvar x += len(42) =====


  setvar x += len(42)
  ^~~~~~
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: 
    var d = {}
    = d[len("foo"), len(42)]
   =====


      = d[len("foo"), len(42)]
      ^
[ -c flag ]:3: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: 
    var d = {}
    setvar d[len(42)] = "foo"
   =====


      setvar d[len(42)] = "foo"
      ^~~~~~
[ -c flag ]:3: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: 
    var d = {}
    setvar len(42)->z = "foo"
   =====


      setvar len(42)->z = "foo"
      ^~~~~~
[ -c flag ]:3: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: 
  hay define Package
  Package foo {
    x = len(42)
  }
   =====


      x = len(42)
      ^
[ -c flag ]:4: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: if (len(42)) { echo hi } =====


  if (len(42)) { echo hi }
  ^~
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: while (len(42)) { echo hi } =====


  while (len(42)) { echo hi }
  ^~~~~
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: for x in (len(42)) { echo $x } =====


  for x in (len(42)) { echo $x }
  ^~~
[ -c flag ]:1: fatal: Type error in expression: object of type 'int' has no len()
OK  test-EvalExpr-calls
*** Running test-eggex

===== CASE:  = / [ \x00 \xff ] / =====


(Regex)   '[\x00\xff]'
(re.CharClass negated:F terms:[(CharCode i:0 u_braced:F spid:7) (CharCode i:255 u_braced:F spid:9)])

===== CASE:  = / [ \x00-\xff ] / =====


(Regex)   '[\x00-\xff]'
(re.CharClass
  negated: F
  terms: [
    (char_class_term.Range
      start: (CharCode i:0 u_braced:F spid:7)
      end: (CharCode i:255 u_braced:F spid:9)
    )
  ]
)

===== CASE: = / [ $'\x00 \xff' ] / =====


  = / [ $'\x00 \xff' ] /
        ^~
[ -c flag ]:1: fatal: Use unquoted char literal for byte 255, which is >= 128 (avoid confusing a set of bytes with a sequence)

===== CASE:  = / [ \u{0} ] / =====


(Regex)   '[\x00]'
(re.CharClass negated:F terms:[(CharCode i:0 u_braced:T spid:7)])

===== CASE:  = / [ \u{0}-\u{1} ] / =====


(Regex)   '[\x00-\x01]'
(re.CharClass
  negated: F
  terms: [
    (char_class_term.Range
      start: (CharCode i:0 u_braced:T spid:7)
      end: (CharCode i:1 u_braced:T spid:9)
    )
  ]
)

===== CASE:  = / [ \u{80} ] / =====


   = / [ \u{80} ] /
         ^~~~~~
[ -c flag ]:1: fatal: ERE can't express char code 128

===== CASE:  = / [ \u{7f}-\u{80} ] / =====


   = / [ \u{7f}-\u{80} ] /
                ^~~~~~
[ -c flag ]:1: fatal: ERE can't express char code 128

===== CASE:  = / [ \\ "^-]" "abc" ] / =====


(Regex)   '[]abc\\\\^-]'
(re.CharClass
  negated: F
  terms: [
    (CharCode i:92 u_braced:F spid:7)
    (CharCode i:94 u_braced:F spid:9)
    (CharCode i:45 u_braced:F spid:9)
    (CharCode i:93 u_braced:F spid:9)
    (CharCode i:97 u_braced:F spid:13)
    (CharCode i:98 u_braced:F spid:13)
    (CharCode i:99 u_braced:F spid:13)
  ]
)

===== CASE:  = / [ a-'^' ] / =====


   = / [ a-'^' ] /
            ^
[ -c flag ]:1: fatal: Can't use char 94 as end of range in ERE syntax

===== CASE:  = / [ '-'-z ] / =====


   = / [ '-'-z ] /
          ^
[ -c flag ]:1: fatal: Can't use char 45 as start of range in ERE syntax

===== CASE:  = / [ ']'-z ] / =====


   = / [ ']'-z ] /
          ^
[ -c flag ]:1: fatal: Can't use char 93 as start of range in ERE syntax
OK  test-eggex
*** Running test-hay

===== CASE: 
hay define package user TASK

hay eval :result {
  package foo {
    oops
  }

  bad 2
}
 =====


      oops
      ^~~~
[ -c flag ]:6: Unknown command 'oops' while running hay
[ -c flag ]:6: errexit PID 4825: Command failed with status 127

===== CASE: 
hay define package user TASK

hay eval :result {
  package foo {
    version=1
  }
}
 =====


      version=1
      ^~~~~~~~
[ -c flag ]:6: Use const or var/setvar to assign in Oil (parse_sh_assign)
OK  test-hay
*** Running test-hay-osh

===== CASE: 
hay define package TASK

package foo {
  version = 1
}
 =====


    version = 1
    ^~~~~~~
[ -c flag ]:5: 'version' not found
  }
  ^
[ -c flag ]:6: Unexpected right brace

===== CASE: 
shopt --set parse_brace

hay define package TASK

hay eval :result {
  package foo {
    version = 1
  }
}
 =====


      version = 1
      ^~~~~~~
[ -c flag ]:8: Unknown command 'version' while running hay
OK  test-hay-osh
*** Running test-oil-expr-eval

===== CASE: echo $[42 / 0 ] =====


  echo $[42 / 0 ]
            ^
[ -c flag ]:1: fatal: divide by zero

===== CASE: var d = {}; var item = d->nonexistent =====


  var d = {}; var item = d->nonexistent
                          ^~
[ -c flag ]:1: fatal: dict entry not found

===== CASE: var d = {}; var item = d["nonexistent"] =====


  var d = {}; var item = d["nonexistent"]
              ^~~
[ -c flag ]:1: fatal: dict entry not found

===== CASE: var a = []; setvar item = a[1] =====


  var a = []; setvar item = a[1]
              ^~~~~~
[ -c flag ]:1: fatal: index out of range

===== CASE: const x = 42 / 0 =====


  const x = 42 / 0
               ^
[ -c flag ]:1: fatal: divide by zero

===== CASE: var x = "z" ++ $(false) =====


  var x = "z" ++ $(false)
                   ^~~~~
[ -c flag ]:1: errexit PID 4859: Command failed with status 1
[ -c flag ]:1: errexit PID 4856: Command Sub exited with status 1

===== CASE: case $[42 / 0] { (*) echo hi ;; }; echo OK =====


  case $[42 / 0] { (*) echo hi ;; }; echo OK
            ^
[ -c flag ]:1: fatal: divide by zero

===== CASE: var d = {}; for x in $[d->zzz] { echo hi } =====


  var d = {}; for x in $[d->zzz] { echo hi }
                          ^~
[ -c flag ]:1: fatal: dict entry not found
OK  test-oil-expr-eval
*** Running test-oil-word-eval

===== CASE: echo $maybe("foo") =====


  echo $maybe("foo")
       ^~~~~~
[ -c flag ]:1: fatal: Expected string-like value (Bool, Int, Str), but got <type 'list'>

===== CASE: echo $identity({key: "val"}) =====


  echo $identity({key: "val"})
       ^~~~~~~~~
[ -c flag ]:1: fatal: Expected string-like value (Bool, Int, Str), but got <class 'pylib.collections_.OrderedDict'>

===== CASE: write -- @identity([{key: "val"}]) =====


  write -- @identity([{key: "val"}])
           ^~~~~~~~~
[ -c flag ]:1: fatal: Expected string-like value (Bool, Int, Str), but got <class 'pylib.collections_.OrderedDict'>

===== CASE: const x = [1, 2]; echo $x =====


[??? no location ???] fatal: Expected string-like value (Bool, Int, Str), but got <type 'list'>
OK  test-oil-word-eval
*** Running test-regex-literals

===== CASE: var sq = / 'foo'+ / =====



===== CASE: 
  var dq = / "foo"+ /
  echo $dq
   =====


    var dq = / "foo"+ /
               ^
[ -c flag ]:2: fatal: POSIX EREs don't have groups without capture, so this node needs () around it.

===== CASE: 
  var dq = / ("foo")+ /
  echo $dq

  var dq2 = / <"foo">+ /
  echo $dq2
   =====


(foo)+
(foo)+

===== CASE: 
  var literal = "foo"
  var svs = / $literal+ /
  echo $svs
   =====


    var svs = / $literal+ /
                ^~~~~~~~
[ -c flag ]:3: fatal: POSIX EREs don't have groups without capture, so this node needs () around it.

===== CASE: 
  var literal = "foo"
  var bvs = / ${literal}+ /
  echo $bvs
   =====


    var bvs = / ${literal}+ /
                ^~
[ -c flag ]:3: fatal: POSIX EREs don't have groups without capture, so this node needs () around it.
OK  test-regex-literals
*** Running test-undefined-vars

===== CASE: echo hi; const y = 2 + x + 3 =====


hi
  echo hi; const y = 2 + x + 3
                         ^
[ -c flag ]:1: fatal: Undefined variable 'x'

===== CASE: if (x) { echo hello } =====


  if (x) { echo hello }
      ^
[ -c flag ]:1: fatal: Undefined variable 'x'

===== CASE: if (${x}) { echo hi } =====


  if (${x}) { echo hi }
        ^
[ -c flag ]:1: fatal: Undefined variable 'x'

===== CASE: const x = / @undef /; echo hi =====


  const x = / @undef /; echo hi
               ^~~~~
[ -c flag ]:1: fatal: Undefined variable 'undef'

===== CASE: var x = undef; echo $x =====


  var x = undef; echo $x
          ^~~~~
[ -c flag ]:1: fatal: Undefined variable 'undef'

===== CASE: setvar a = undef =====


  setvar a = undef
             ^~~~~
[ -c flag ]:1: fatal: Undefined variable 'undef'
OK  test-undefined-vars
*** Running test-user-reported

===== CASE: 
  var snippets = [{status: 42}]
  for snippet in (snippets) {
    if (len(42)) {
      echo hi
    }
  }
   =====


      if (len(42)) {
      ^~
[ -c flag ]:4: fatal: Type error in expression: object of type 'int' has no len()

===== CASE: 
  var count = 0

  # The $ causes a weird error
  while (count < len(count)) {
    setvar count += 1
  }
   =====


    while (count < len(count)) {
    ^~~~~
[ -c flag ]:5: fatal: Type error in expression: object of type 'int' has no len()
OK  test-user-reported

test/oil-runtime-errors.sh: 9 tests passed.