ninja: no work to do.

///
/// Cases in Files
///


===== CASE: FILE test/parse-errors/01-bad-func.sh =====

  foo (,)
       ^
test/parse-errors/01-bad-func.sh:15: Syntax error in expression (near Id.Arith_Comma)

===== CASE: FILE test/parse-errors/02-bad-func.sh =====

  foo()
         ^
test/parse-errors/02-bad-func.sh:3: Unexpected word while parsing compound command (Id.Eof_Real)

===== CASE: FILE test/parse-errors/05-unterminated-single.sh =====

A
B
  echo 'C
       ^
test/parse-errors/05-unterminated-single.sh:5: Unexpected EOF in single-quoted string that began here

===== CASE: FILE test/parse-errors/06-unterminated-double-long.sh =====

A
B
  echo 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 "
                                                                                               ^
test/parse-errors/06-unterminated-double-long.sh:9: Unexpected EOF reading double-quoted string that began here

===== CASE: FILE test/parse-errors/06-unterminated-double.sh =====

A
B
  echo "0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
       ^
test/parse-errors/06-unterminated-double.sh:6: Unexpected EOF reading double-quoted string that began here

===== CASE: FILE test/parse-errors/07-unterminated-here-doc-2.sh =====

  cat << "$@"
         ^
test/parse-errors/07-unterminated-here-doc-2.sh:2: Invalid here doc delimiter

===== CASE: FILE test/parse-errors/07-unterminated-here-doc.sh =====

  cat <<EOF
      ^~
test/parse-errors/07-unterminated-here-doc.sh:5: Couldn't find terminator for here doc that starts here

///
/// Cases in Functions, with strings
///

*** Running test-append

===== CASE: -n -c a[-1]+=(4 5) =====


  a[-1]+=(4 5)
         ^
[ -c flag ]:1: Unexpected left paren (might need a space before it)
OK  test-append
*** Running test-args-parse-builtin

===== CASE: -c read -x =====


  read -x
       ^~
[ -c flag ]:1: 'read' doesn't accept flag -x

===== CASE: -c builtin read -x =====


  builtin read -x
               ^~
[ -c flag ]:1: 'read' doesn't accept flag -x

===== CASE: -c read -n =====


  read -n
       ^~
[ -c flag ]:1: 'read' expected argument to '-n'

===== CASE: -c read -n x =====


  read -n x
          ^
[ -c flag ]:1: 'read' expected integer after -n, got 'x'

===== CASE: -c set -o errexit +o oops =====


  set -o errexit +o oops
  ^~~
[ -c flag ]:1: 'set' got invalid option 'oops'
OK  test-args-parse-builtin
*** Running test-args-parse-more

===== CASE: -c set -z =====


  set -z
      ^~
[ -c flag ]:1: 'set' got invalid flag '-z'

===== CASE: -c shopt -s foo =====


  shopt -s foo
  ^~~~~
[ -c flag ]:1: 'shopt' got invalid option 'foo'

===== CASE: -c shopt -z =====


  shopt -z
        ^~
[ -c flag ]:1: 'shopt' doesn't accept flag -z
OK  test-args-parse-more
*** Running test-arith-context

===== CASE: -n -c a[x+]=1 =====


  a[x+]=1
      ^
[ array LHS in [ -c flag ] ]:1: Unexpected end of input

===== CASE: -c eval a[x+]=1 =====


  a[x+]=1
      ^
[ array LHS in [ eval arg at line 1 of [ -c flag ] ] ]:1: Unexpected end of input

===== CASE: -n -c a[]=1 =====


  a[]=1
    ^
[ array LHS in [ -c flag ] ]:1: Unexpected end of input

===== CASE: -n -c a[*]=1 =====


  a[*]=1
    ^
[ array LHS in [ -c flag ] ]:1: Token can't be used in prefix position

===== CASE: -n -c (( a + { )) =====


  (( a + { ))
         ^
[ -c flag ]:1: Unexpected token while parsing arithmetic: '{'

===== CASE: -n -c (( a + } )) =====


  (( a + } ))
         ^
[ -c flag ]:1: Token can't be used in prefix position
OK  test-arith-context
*** Running test-arith-expr

===== CASE: -n -c $(( 1 + + )) =====


  $(( 1 + + ))
            ^
[ -c flag ]:1: Token can't be used in prefix position

===== CASE: -n -c $(( 1 2 )) =====


  $(( 1 2 ))
        ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen)

===== CASE: -n -c $(( - ; )) =====


  $(( - ; ))
        ^
[ -c flag ]:1: Token can't be used in prefix position

===== CASE: -n -c $(( ` )) =====


  $(( ` ))
      ^
[ -c flag ]:1: Unexpected EOF while looking for closing backtick

===== CASE: -n -c $(( $ )) =====


  $(( $ ))
      ^
[ -c flag ]:1: Unexpected token while parsing arithmetic: '$'

===== CASE: -n -c $(( x+1 = 42 )) =====


  $(( x+1 = 42 ))
          ^
[ -c flag ]:1: Left-hand side of this assignment is invalid

===== CASE: -n -c $(( (x+42)++ )) =====


  $(( (x+42)++ ))
            ^~
[ -c flag ]:1: Left-hand side of this assignment is invalid

===== CASE: -n -c $(( ++(x+42) )) =====


  $(( ++(x+42) ))
      ^~
[ -c flag ]:1: Left-hand side of this assignment is invalid
OK  test-arith-expr
*** Running test-arith-integration

===== CASE: -n -c echo $((a b)) =====


  echo $((a b))
            ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen)

===== CASE: -n -c ((a b)) =====


  ((a b))
      ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen)

===== CASE: -n -c for ((x=0; x<5; x++)); do echo $x; done =====


(command.ForExpr
  keyword:<KW_For for>
  init:(arith_expr.BinaryAssign
    op_id:Arith_Equal
    left:<Lit_ArithVarLike x>
    right:(w <Lit_Digits 0>)
  )
  cond:(arith_expr.Binary
    op:<Arith_Less "<">
    left:<Lit_ArithVarLike x>
    right:(w <Lit_Digits 5>)
  )
  update:(arith_expr.UnaryAssign
    op_id:Node_PostDPlus
    child:<Lit_ArithVarLike x>
  )
  body:(command.DoGroup
    left:<KW_Do do>
    children:[
      (command.Sentence
        child:(C (w <Lit_Chars echo>) (w ($ x)))
        terminator:<Op_Semi ";">
      )
    ]
    right:<KW_Done done>
  )
)

===== CASE: -n -c for ((; x<5; x++)); do echo $x; done =====


(command.ForExpr
  keyword:<KW_For for>
  init:(arith_expr.EmptyZero)
  cond:(arith_expr.Binary
    op:<Arith_Less "<">
    left:<Lit_ArithVarLike x>
    right:(w <Lit_Digits 5>)
  )
  update:(arith_expr.UnaryAssign
    op_id:Node_PostDPlus
    child:<Lit_ArithVarLike x>
  )
  body:(command.DoGroup
    left:<KW_Do do>
    children:[
      (command.Sentence
        child:(C (w <Lit_Chars echo>) (w ($ x)))
        terminator:<Op_Semi ";">
      )
    ]
    right:<KW_Done done>
  )
)

===== CASE: -n -c for ((; ; x++)); do echo $x; done =====


(command.ForExpr
  keyword:<KW_For for>
  init:(arith_expr.EmptyZero)
  cond:...0x3ffffffc
  update:(arith_expr.UnaryAssign
    op_id:Node_PostDPlus
    child:<Lit_ArithVarLike x>
  )
  body:(command.DoGroup
    left:<KW_Do do>
    children:[
      (command.Sentence
        child:(C (w <Lit_Chars echo>) (w ($ x)))
        terminator:<Op_Semi ";">
      )
    ]
    right:<KW_Done done>
  )
)

===== CASE: -n -c for ((; ;)); do echo $x; done =====


(command.ForExpr
  keyword:<KW_For for>
  init:(arith_expr.EmptyZero)
  cond:...0x3ffffffc
  update:...0x3ffffffc
  body:(command.DoGroup
    left:<KW_Do do>
    children:[
      (command.Sentence
        child:(C (w <Lit_Chars echo>) (w ($ x)))
        terminator:<Op_Semi ";">
      )
    ]
    right:<KW_Done done>
  )
)

===== CASE: -n -c for ((x=0; x<5; x++ b)); do echo $x; done =====


  for ((x=0; x<5; x++ b)); do echo $x; done
                      ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen)

===== CASE: -n -c for ((x=0 b; x<5; x++)); do echo $x; done =====


  for ((x=0 b; x<5; x++)); do echo $x; done
            ^
[ -c flag ]:1: Expected ; here

===== CASE: -n -c for ((x=0; x<5 b; x++)); do echo $x; done =====


  for ((x=0; x<5 b; x++)); do echo $x; done
                 ^
[ -c flag ]:1: Expected ; here

===== CASE: -n -c ${a:1+2 b} =====


  ${a:1+2 b}
           ^
[ -c flag ]:1: Expected : or } in slice

===== CASE: -n -c ${a:1+2:3+4 b} =====


  ${a:1+2:3+4 b}
              ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RBrace)

===== CASE: -n -c ${a[1+2 b]} =====


  ${a[1+2 b]}
          ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RBracket)
OK  test-arith-integration
*** Running test-arith-sub

===== CASE: -n -c echo $(( )) =====


(C
  (w <Lit_Chars echo>)
  (w
    (word_part.ArithSub
      left:<Left_DollarDParen "$((">
      anode:(arith_expr.EmptyZero)
      right:<Right_DollarDParen ")">
    )
  )
)

===== CASE: -n -c echo $(()) =====


(C
  (w <Lit_Chars echo>)
  (w
    (word_part.ArithSub
      left:<Left_DollarDParen "$((">
      anode:(arith_expr.EmptyZero)
      right:<Right_DollarDParen ")">
    )
  )
)

===== CASE: -n -c echo $(()x =====


  echo $(()x
           ^
[ -c flag ]:1: Expected second ) to end arith sub

===== CASE: -n -c echo $(() =====


  echo $(()
           ^
[ -c flag ]:1: Expected second ) to end arith sub

===== CASE: -n -c echo $(( 1 + 2 ; =====


  echo $(( 1 + 2 ;
                 ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RParen)

===== CASE: -n -c echo $(( 1 + 2 ); =====


  echo $(( 1 + 2 );
                  ^
[ -c flag ]:1: Expected second ) to end arith sub

===== CASE: -n -c echo $((  =====


  echo $((
           ^
[ -c flag ]:1: Unexpected end of input

===== CASE: -n -c echo $(( 1 =====


  echo $(( 1
            ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Eof_Real != Id.Arith_RParen)
OK  test-arith-sub
*** Running test-array-literal

===== CASE: -n -c a=(1 & 2) =====


  a=(1 & 2)
       ^
[ -c flag ]:1: Unexpected token in array literal

===== CASE: -n -c a= (1 2) =====


  a= (1 2)
    ^
[ -c flag ]:1: Expected ( after =

===== CASE: -n -c a=(1 2 =====


  a=(1 2
        ^
[ -c flag ]:1: Unexpected token in array literal

===== CASE: -n -c a=(1 ${2@} ) =====


  a=(1 ${2@} )
          ^
[ -c flag ]:1: Unexpected token in ${} (VOp3)
OK  test-array-literal
*** Running test-bool-expr

===== CASE: -n -c [[ a b ]] =====


  [[ a b ]]
       ^
[ -c flag ]:1: Expected ]]

===== CASE: -n -c [[ a "a"$(echo hi)"b" ]] =====


  [[ a "a"$(echo hi)"b" ]]
       ^
[ -c flag ]:1: Expected ]]

===== CASE: -n -c [[ a == ]] =====


  [[ a == ]]
            ^
[ -c flag ]:1: Expected ]]

===== CASE: -n -c [[ ( 1 == 2 - ]] =====


  [[ ( 1 == 2 - ]]
              ^
[ -c flag ]:1: Expected ), got word.Compound

===== CASE: -n -c [[ == ]] =====


  [[ == ]]
     ^~
[ -c flag ]:1: Unexpected token in boolean expression (Id.BoolBinary_GlobDEqual)

===== CASE: -n -c [[ ) ]] =====


  [[ ) ]]
     ^
[ -c flag ]:1: Unexpected token in boolean expression (Id.Op_RParen)

===== CASE: -n -c [[ ( ]] =====


  [[ ( ]]
       ^~
[ -c flag ]:1: Unexpected token in boolean expression (Id.Lit_DRightBracket)

===== CASE: -n -c [[ ;;; ]] =====


  [[ ;;; ]]
     ^~
[ -c flag ]:1: Unexpected token in boolean expression (Id.Op_DSemi)

===== CASE: -n -c [[ =====


  [[
    ^
[ -c flag ]:1: Unexpected token in boolean expression (Id.Eof_Real)

===== CASE: -n -c [[ ( a == b foo${var} ]] =====


  [[ ( a == b foo${var} ]]
              ^~~
[ -c flag ]:1: Expected ), got word.Compound
OK  test-bool-expr
*** Running test-braced-var-sub

===== CASE: -n -c echo ${x*} =====


  echo ${x*}
          ^
[ -c flag ]:1: Unexpected token in ${} (VOp3)

===== CASE: -n -c echo ${x@} =====


  echo ${x@}
          ^
[ -c flag ]:1: Unexpected token in ${} (VOp3)

===== CASE: -n -c echo ${x.} =====


  echo ${x.}
          ^
[ -c flag ]:1: Expected } to close ${
OK  test-braced-var-sub
*** Running test-case
--- test-case YES case $x in foo) echo
esac

===== CASE: -n -c case $x in foo) echo
esac =====


(command.Case
  case_kw:<KW_Case case>
  to_match:(case_arg.Word w:(w ($ x)))
  arms_start:<KW_In in>
  arms:[
    (CaseArm
      left:<Lit_Chars foo>
      pattern:(pat.Words words:[(w <Lit_Chars foo>)])
      middle:<Right_CasePat ")">
      action:[(C (w <Lit_Chars echo>))]
    )
  ]
  arms_end:<KW_Esac esac>
)

bash=0
--- test-case YES case $x in foo) echo ;; esac

===== CASE: -n -c case $x in foo) echo ;; esac =====


(command.Case
  case_kw:<KW_Case case>
  to_match:(case_arg.Word w:(w ($ x)))
  arms_start:<KW_In in>
  arms:[
    (CaseArm
      left:<Lit_Chars foo>
      pattern:(pat.Words words:[(w <Lit_Chars foo>)])
      middle:<Right_CasePat ")">
      action:[(C (w <Lit_Chars echo>))]
      right:<Op_DSemi ";;">
    )
  ]
  arms_end:<KW_Esac esac>
)

bash=0
--- test-case YES case $x in foo) echo ;& esac

===== CASE: -n -c case $x in foo) echo ;& esac =====


(command.Case
  case_kw:<KW_Case case>
  to_match:(case_arg.Word w:(w ($ x)))
  arms_start:<KW_In in>
  arms:[
    (CaseArm
      left:<Lit_Chars foo>
      pattern:(pat.Words words:[(w <Lit_Chars foo>)])
      middle:<Right_CasePat ")">
      action:[(C (w <Lit_Chars echo>))]
      right:<Op_SemiAmp ";&">
    )
  ]
  arms_end:<KW_Esac esac>
)

bash=0
--- test-case YES case $x in foo) echo ;;& esac

===== CASE: -n -c case $x in foo) echo ;;& esac =====


(command.Case
  case_kw:<KW_Case case>
  to_match:(case_arg.Word w:(w ($ x)))
  arms_start:<KW_In in>
  arms:[
    (CaseArm
      left:<Lit_Chars foo>
      pattern:(pat.Words words:[(w <Lit_Chars foo>)])
      middle:<Right_CasePat ")">
      action:[(C (w <Lit_Chars echo>))]
      right:<Op_DSemiAmp ";;&">
    )
  ]
  arms_end:<KW_Esac esac>
)

bash=0
--- test-case NO ;&

===== CASE: -n -c ;& =====


  ;&
  ^~
[ -c flag ]:1: Invalid word while parsing command
bash: -c: line 0: syntax error near unexpected token `;&'
bash: -c: line 0: `;&'
bash=1
--- test-case NO echo ;&

===== CASE: -n -c echo ;& =====


  echo ;&
       ^~
[ -c flag ]:1: Invalid word while parsing command line (Id.Op_SemiAmp)
bash: -c: line 0: syntax error near unexpected token `;&'
bash: -c: line 0: `echo ;&'
bash=1
--- test-case NO echo ;;&

===== CASE: -n -c echo ;;& =====


  echo ;;&
       ^~~
[ -c flag ]:1: Invalid word while parsing command line (Id.Op_DSemiAmp)
bash: -c: line 0: syntax error near unexpected token `;;&'
bash: -c: line 0: `echo ;;&'
bash=1
OK  test-case
*** Running test-cmd-parse

===== CASE: -n -c FOO=1 break =====


  FOO=1 break
  ^~~~
[ -c flag ]:1: Control flow shouldn't have environment bindings

===== CASE: -n -c break 1 2 =====


  break 1 2
          ^
[ -c flag ]:1: Unexpected argument to 'break'

===== CASE: -n -c x"y"() { echo hi; } =====


  x"y"() { echo hi; }
  ^
[ -c flag ]:1: Invalid function name

===== CASE: -n -c function x"y" { echo hi; } =====


  function x"y" { echo hi; }
           ^
[ -c flag ]:1: Invalid KSH-style function name

===== CASE: -n -c } =====


  }
  ^
[ -c flag ]:1: Unexpected right brace

===== CASE: -n -c case foo in *) echo  =====


  case foo in *) echo
                      ^
[ -c flag ]:1: Expected ;; or esac

===== CASE: -n -c case foo in x|) echo  =====


  case foo in x|) echo
                ^
[ -c flag ]:1: Expected case pattern

===== CASE: -n -c ls foo| =====


  ls foo|
         ^
[ -c flag ]:1: Unexpected EOF while parsing command

===== CASE: -n -c ls foo&& =====


  ls foo&&
          ^
[ -c flag ]:1: Unexpected EOF while parsing command

===== CASE: -n -c foo() =====


  foo()
       ^
[ -c flag ]:1: Unexpected word while parsing compound command (Id.Eof_Real)

===== CASE: -n -c break >out =====


(command.ControlFlow keyword:<ControlFlow_Break break>)

===== CASE: -n -c break >out =====


  break >out
  ^~~~~
[ -c flag ]:1: Control flow shouldn't have redirects

===== CASE: -n -c [ ( x ] =====


  [ ( x ]
        ^
[ -c flag ]:1: Syntax error in expression (near Id.Op_RBracket)
OK  test-cmd-parse
*** Running test-command-sub

===== CASE: -n -c  
    echo line 2
    echo $( echo  =====


      echo $( echo
                   ^
[ -c flag ]:3: Invalid word while parsing command list

===== CASE: -n -c  
    echo line 2
    echo ` echo  =====


      echo ` echo
           ^
[ -c flag ]:3: Unexpected EOF while looking for closing backtick

===== CASE: -n -c 
    echo line 2
    echo ` echo \`  =====


      echo ` echo \`
           ^
[ -c flag ]:3: Unexpected EOF while looking for closing backtick

===== CASE: -n -c 
    echo line 2
    echo ` echo \`unclosed `  =====


      echo ` echo \`unclosed `
                  ^
[ backticks in [ -c flag ] ]:3: Unexpected EOF while looking for closing backtick

===== CASE: -n -c echo `for x in` =====


  echo `for x in`
                ^
[ backticks in [ -c flag ] ]:1: Invalid word in for loop
OK  test-command-sub
*** Running test-dparen

===== CASE: -n -c (()) =====


(command.DParen
  left:<Op_DLeftParen "((">
  child:(arith_expr.EmptyZero)
  right:<Op_DRightParen ")">
)

===== CASE: -n -c (( )) =====


(command.DParen
  left:<Op_DLeftParen "((">
  child:(arith_expr.EmptyZero)
  right:<Op_DRightParen ")">
)

===== CASE: -n -c (( ) =====


  (( )
      ^
[ -c flag ]:1: Expected second ) to end arith statement

===== CASE: -n -c (( )x =====


  (( )x
      ^
[ -c flag ]:1: Expected second ) to end arith statement

===== CASE: -n -c $(echo $(( 1 + 2 ))) =====


(C
  (w
    (CommandSub
      left_token:<Left_DollarParen "$(">
      child:(C
        (w <Lit_Chars echo>)
        (w
          (word_part.ArithSub
            left:<Left_DollarDParen "$((">
            anode:(arith_expr.Binary
              op:<Arith_Plus "+">
              left:(w <Lit_Digits 1>)
              right:(w <Lit_Digits 2>)
            )
            right:<Right_DollarDParen ")">
          )
        )
      )
      right:<Eof_RParen ")">
    )
  )
)

===== CASE: -n -c $( (())) =====


(C
  (w
    (CommandSub
      left_token:<Left_DollarParen "$(">
      child:(command.DParen
        left:<Op_DLeftParen "((">
        child:(arith_expr.EmptyZero)
        right:<Op_DRightParen ")">
      )
      right:<Eof_RParen ")">
    )
  )
)

===== CASE: -n -c (( 1 + 2 / =====


  (( 1 + 2 /
            ^
[ -c flag ]:1: Unexpected end of input

===== CASE: -n -c (( 1 + 2 )/ =====


  (( 1 + 2 )/
            ^
[ -c flag ]:1: Expected second ) to end arith statement

===== CASE: -n -c (( 1 =====


  (( 1
      ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Eof_Real != Id.Arith_RParen)

===== CASE: -n -c (( =====


  ((
    ^
[ -c flag ]:1: Unexpected end of input
OK  test-dparen
*** Running test-eval_parse_error

===== CASE: -c 
  x="echo )"
  eval $x
   =====


  echo )
       ^
[ eval arg at line 3 of [ -c flag ] ]:1

    eval $x
    ^~~~
[ -c flag ]:3: Invalid word while parsing command line (Id.Op_RParen)
OK  test-eval_parse_error
*** Running test-extra-newlines

===== CASE: -n -c 
  for
  do
  done
   =====


    for
       ^
[ -c flag ]:2: Expected loop variable (a constant word)

===== CASE: -n -c 
  case
  in esac
   =====


    case
        ^
[ -c flag ]:2: Expected a word to match against

===== CASE: -n -c 
  while
  do
  done
   =====


    do
    ^~
[ -c flag ]:3: Expected a condition

===== CASE: -n -c 
  if
  then
  fi
   =====


    then
    ^~~~
[ -c flag ]:3: Expected a condition

===== CASE: -n -c 
  if true
  then
  elif
  then
  fi
   =====


    then
    ^~~~
[ -c flag ]:5: Expected a condition

===== CASE: -n -c 
  case |
  in
  esac
   =====


    case |
         ^
[ -c flag ]:2: Expected a word to match against

===== CASE: -n -c 
  case ;
  in
  esac
   =====


    case ;
         ^
[ -c flag ]:2: Expected a word to match against

===== CASE: -n -c 
  if
  true
  then
  fi
   =====


(command.If
  if_kw:<KW_If if>
  arms:[
    (IfArm
      keyword:...0x12d2
      cond:[(C (w <Lit_Chars "true">))]
      then_kw:<KW_Then then>
      action:[]
      then_tok:...0x1282
    )
  ]
  else_action:[]
  fi_kw:<KW_Fi fi>
)

===== CASE: -n -c 
  while
  false
  do
  done
   =====


(command.WhileUntil
  keyword:<KW_While while>
  cond:[(C (w <Lit_Chars "false">))]
  body:(command.DoGroup left:<KW_Do do> children:[] right:<KW_Done done>)
)

===== CASE: -n -c 
  while
  true;
  false
  do
  done
   =====


(command.WhileUntil
  keyword:<KW_While while>
  cond:[
    (command.Sentence child:(C (w <Lit_Chars "true">)) terminator:<Op_Semi ";">)
    (C (w <Lit_Chars "false">))
  ]
  body:(command.DoGroup left:<KW_Do do> children:[] right:<KW_Done done>)
)

===== CASE: -n -c 
  if true
  then
  fi
   =====


(command.If
  if_kw:<KW_If if>
  arms:[
    (IfArm
      keyword:...0x12ca
      cond:[(C (w <Lit_Chars "true">))]
      then_kw:<KW_Then then>
      action:[]
      then_tok:...0x1282
    )
  ]
  else_action:[]
  fi_kw:<KW_Fi fi>
)

===== CASE: -n -c 
  while true;
        false
  do
  done
   =====


(command.WhileUntil
  keyword:<KW_While while>
  cond:[
    (command.Sentence child:(C (w <Lit_Chars "true">)) terminator:<Op_Semi ";">)
    (C (w <Lit_Chars "false">))
  ]
  body:(command.DoGroup left:<KW_Do do> children:[] right:<KW_Done done>)
)
OK  test-extra-newlines
*** Running test-here-doc

===== CASE: -n -c cat <<EOF
$(( 1 * ))  
EOF
 =====


  $(( 1 * ))
          ^
[ -c flag ]:2: Token can't be used in prefix position

===== CASE: -n -c cat <<EOF
invalid: ${a!}
EOF
 =====


  invalid: ${a!}
              ^
[ -c flag ]:2: Expected } to close ${

===== CASE: -n -c cat <<EOF
$(for x in )
EOF
 =====


  $(for x in )
             ^
[ -c flag ]:2: Invalid word in for loop
OK  test-here-doc
*** Running test-here-doc-delimiter

===== CASE: -n -c cat << $(invalid here end) =====


  cat << $(invalid here end)
         ^~
[ -c flag ]:1: Unterminated here doc began here

===== CASE: -n -c cat << $((1+2)) =====


  cat << $((1+2))
         ^~~
[ -c flag ]:1: Unterminated here doc began here

===== CASE: -n -c cat << a=(1 2 3) =====


  cat << a=(1 2 3)
         ^~
[ -c flag ]:1: Unterminated here doc began here

===== CASE: -n -c cat << \a$(invalid) =====


  cat << \a$(invalid)
         ^~
[ -c flag ]:1: Unterminated here doc began here

===== CASE: -n -c cat << "double"$(invalid) =====


  cat << "double"$(invalid)
         ^
[ -c flag ]:1: Unterminated here doc began here

===== CASE: -n -c cat << ~foo/$(invalid) =====


  cat << ~foo/$(invalid)
         ^
[ -c flag ]:1: Unterminated here doc began here

===== CASE: -n -c cat << $var/$(invalid) =====


  cat << $var/$(invalid)
         ^~~~
[ -c flag ]:1: Unterminated here doc began here
OK  test-here-doc-delimiter
*** Running test-invalid-brace-ranges

===== CASE: -n -c echo {1..3..-1} =====


  echo {1..3..-1}
        ^~~~~~~~
[ -c flag ]:1: Invalid step -1 for ascending integer range

===== CASE: -n -c echo {1..3..0} =====


  echo {1..3..0}
        ^~~~~~~
[ -c flag ]:1: Step can't be 0

===== CASE: -n -c echo {3..1..1} =====


  echo {3..1..1}
        ^~~~~~~
[ -c flag ]:1: Invalid step 1 for descending integer range

===== CASE: -n -c echo {3..1..0} =====


  echo {3..1..0}
        ^~~~~~~
[ -c flag ]:1: Step can't be 0

===== CASE: -n -c echo {a..Z} =====


  echo {a..Z}
        ^~~~
[ -c flag ]:1: Mismatched cases in character range

===== CASE: -n -c echo {a..z..0} =====


  echo {a..z..0}
        ^~~~~~~
[ -c flag ]:1: Step can't be 0

===== CASE: -n -c echo {a..z..-1} =====


  echo {a..z..-1}
        ^~~~~~~~
[ -c flag ]:1: Invalid step -1 for ascending character range

===== CASE: -n -c echo {z..a..1} =====


  echo {z..a..1}
        ^~~~~~~
[ -c flag ]:1: Invalid step 1 for descending character range
OK  test-invalid-brace-ranges
*** Running test-nested_source_argvword

===== CASE: -c 
  code="printf % x"
  eval $code
   =====


  %
   ^
[ printf arg at line 1 of [ eval arg at line 3 of [ -c flag ] ] ]:1

  printf % x
         ^
[ eval arg at line 3 of [ -c flag ] ]:1

    eval $code
    ^~~~
[ -c flag ]:3: Expected a printf format character
OK  test-nested_source_argvword
*** Running test-other-builtins

===== CASE: -c shift 1 2 =====


  shift 1 2
  ^~~~~
[ -c flag ]:1: 'shift' got too many arguments

===== CASE: -c shift zzz =====


  shift zzz
  ^~~~~
[ -c flag ]:1: 'shift' Invalid shift argument 'zzz'

===== CASE: -c pushd x y =====


  pushd x y
          ^
[ -c flag ]:1: 'pushd' got too many arguments

===== CASE: -c pwd -x =====


  pwd -x
      ^~
[ -c flag ]:1: 'pwd' doesn't accept flag -x

===== CASE: -c pp x foo a-x =====


  pp x foo a-x
     ^
[ -c flag ]:1: 'pp' got invalid action 'x'

===== CASE: -c wait zzz =====


  wait zzz
       ^~~
[ -c flag ]:1: 'wait' expected PID or jobspec, got 'zzz'

===== CASE: -c wait %jobspec-not-supported =====


  wait %jobspec-not-supported
       ^
[ -c flag ]:1: 'wait' expected PID or jobspec, got '%jobspec-not-supported'

===== CASE: -c unset invalid-var-name =====


  unset invalid-var-name
  ^~~~~
[ -c flag ]:1: fatal: Invalid LHS to modify

===== CASE: -c getopts hc: invalid-var-name =====


  getopts hc: invalid-var-name
              ^~~~~~~~~~~~~~~~
[ -c flag ]:1: 'getopts' got invalid variable name 'invalid-var-name'
OK  test-other-builtins
*** Running test-parse_backticks

===== CASE: -n -c echo `echo hi` =====


(C
  (w <Lit_Chars echo>)
  (w
    (CommandSub
      left_token:<Left_Backtick "`">
      child:(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))
      right:<Backtick_Right "`">
    )
  )
)

===== CASE: -n -c echo "foo = `echo hi`" =====


(C
  (w <Lit_Chars echo>)
  (w
    (DQ
      <Lit_Chars "foo = ">
      (CommandSub
        left_token:<Left_Backtick "`">
        child:(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))
        right:<Backtick_Right "`">
      )
    )
  )
)

===== CASE: +O test-parse_backticks -n -c echo `echo hi` =====


oils: got invalid option 'test-parse_backticks'

===== CASE: +O test-parse_backticks -n -c echo "foo = `echo hi`" =====


oils: got invalid option 'test-parse_backticks'
OK  test-parse_backticks
*** Running test-patsub

===== CASE: -n -c echo ${x/} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w)
        replace:(rhs_word.Empty)
        replace_mode:Undefined_Tok
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x//} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w)
        replace:(rhs_word.Empty)
        replace_mode:Lit_Slash
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x/foo} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w <Lit_Chars foo>)
        replace:(rhs_word.Empty)
        replace_mode:Undefined_Tok
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x//foo} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w <Lit_Chars foo>)
        replace:(rhs_word.Empty)
        replace_mode:Lit_Slash
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x/%foo} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w <Lit_Chars foo>)
        replace:(rhs_word.Empty)
        replace_mode:Lit_Percent
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x///foo} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w <Lit_Slash /> <Lit_Chars foo>)
        replace:(rhs_word.Empty)
        replace_mode:Lit_Slash
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x///} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w <Lit_Slash />)
        replace:(rhs_word.Empty)
        replace_mode:Lit_Slash
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x/%/} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w)
        replace:(w)
        replace_mode:Lit_Percent
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x////} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w <Lit_Slash />)
        replace:(w)
        replace_mode:Lit_Slash
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x/%//} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w)
        replace:(w <Lit_Slash />)
        replace_mode:Lit_Percent
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x//foo/replace
} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w <Lit_Chars foo>)
        replace:(w <Lit_Chars "replace\n">)
        replace_mode:Lit_Slash
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)

===== CASE: -n -c echo ${x//foo/replace$foo} =====


(C
  (w <Lit_Chars echo>)
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name x>
      var_name:x
      suffix_op:(suffix_op.PatSub
        pat:(w <Lit_Chars foo>)
        replace:(w <Lit_Chars replace> ($ foo))
        replace_mode:Lit_Slash
        slash_tok:<VOp2_Slash />
      )
      right:<Right_DollarBrace "}">
    )
  )
)
OK  test-patsub
*** Running test-printf-builtin

===== CASE: -c printf % =====


  %
   ^
[ printf arg at line 1 of [ -c flag ] ]:1

  printf %
         ^
[ -c flag ]:1: Expected a printf format character

===== CASE: -c printf [%Z] =====


  [%Z]
    ^
[ printf arg at line 1 of [ -c flag ] ]:1

  printf [%Z]
         ^
[ -c flag ]:1: Invalid printf format character

===== CASE: -c printf -v "-invalid-" %s foo =====


  -invalid-
           ^
[ dynamic LHS at ? ]:1

[??? no location ???] Unexpected end of input
  printf -v "-invalid-" %s foo
  ^~~~~~
[ -c flag ]:1: 'printf' got invalid LHS expression
OK  test-printf-builtin
*** Running test-proc_func_reserved

===== CASE: -n -c proc p (x) { echo hi } =====


  proc p (x) { echo hi }
  ^~~~
[ -c flag ]:1: proc is a YSH keyword, but this is OSH.

===== CASE: -n -c func f (x) { return (x) } =====


  func f (x) { return (x) }
  ^~~~
[ -c flag ]:1: func is a YSH keyword, but this is OSH.
OK  test-proc_func_reserved
*** Running test-quoted-strings

===== CASE: -n -c "unterminated double =====


  "unterminated double
  ^
[ -c flag ]:1: Unexpected EOF reading double-quoted string that began here

===== CASE: -n -c 'unterminated single =====


  'unterminated single
  ^
[ -c flag ]:1: Unexpected EOF in single-quoted string that began here

===== CASE: -n -c 
  "unterminated double multiline
  line 1
  line 2 =====


    "unterminated double multiline
    ^
[ -c flag ]:2: Unexpected EOF reading double-quoted string that began here

===== CASE: -n -c 
  'unterminated single multiline
  line 1
  line 2 =====


    'unterminated single multiline
    ^
[ -c flag ]:2: Unexpected EOF in single-quoted string that began here
OK  test-quoted-strings
*** Running test-redirect

===== CASE: -n -c echo < << =====


  echo < <<
         ^~
[ -c flag ]:1: Invalid token after redirect operator

===== CASE: -n -c echo $( echo > >>  ) =====


  echo $( echo > >>  )
                 ^~
[ -c flag ]:1: Invalid token after redirect operator
OK  test-redirect
*** Running test-regex-nix

===== CASE: -n -c 
if [[ ! (" ${params[*]} " =~ " -shared " || " ${params[*]} " =~ " -static " ) ]]; then
  echo hi
fi
 =====


(command.If
  if_kw:<KW_If if>
  arms:[
    (IfArm
      keyword:...0x12da
      cond:[
        (command.Sentence
          child:(command.DBracket
            left:<KW_DLeftBracket "[[">
            expr:(bool_expr.LogicalNot
              child:(bool_expr.LogicalOr
                left:(bool_expr.Binary
                  op_id:BoolBinary_EqualTilde
                  left:(w
                    (DQ
                      <Lit_Chars " ">
                      (BracedVarSub
                        left:<Left_DollarBrace "${">
                        name_tok:<VSub_Name params>
                        var_name:params
                        bracket_op:(bracket_op.WholeArray op_id:Arith_Star)
                        right:<Right_DollarBrace "}">
                      )
                      <Lit_Chars " ">
                    )
                  )
                  right:(w (DQ <Lit_Chars " -shared ">))
                )
                right:(bool_expr.Binary
                  op_id:BoolBinary_EqualTilde
                  left:(w
                    (DQ
                      <Lit_Chars " ">
                      (BracedVarSub
                        left:<Left_DollarBrace "${">
                        name_tok:<VSub_Name params>
                        var_name:params
                        bracket_op:(bracket_op.WholeArray op_id:Arith_Star)
                        right:<Right_DollarBrace "}">
                      )
                      <Lit_Chars " ">
                    )
                  )
                  right:(w (DQ <Lit_Chars " -static ">))
                )
              )
            )
            right:<Lit_DRightBracket "]]">
          )
          terminator:<Op_Semi ";">
        )
      ]
      then_kw:<KW_Then then>
      action:[(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))]
      then_tok:...0x11ae
    )
  ]
  else_action:[]
  fi_kw:<KW_Fi fi>
)

===== CASE: -n -c 
if [[ (foo =~ (x) ) ]]; then
  echo hi
fi
 =====


(command.If
  if_kw:<KW_If if>
  arms:[
    (IfArm
      keyword:...0x12d6
      cond:[
        (command.Sentence
          child:(command.DBracket
            left:<KW_DLeftBracket "[[">
            expr:(bool_expr.Binary
              op_id:BoolBinary_EqualTilde
              left:(w <Lit_Chars foo>)
              right:(w
                (word_part.BashRegexGroup
                  left:<BashRegex_LParen "(">
                  child:(w <Lit_Chars x>)
                  right:<Right_BashRegexGroup ")">
                )
              )
            )
            right:<Lit_DRightBracket "]]">
          )
          terminator:<Op_Semi ";">
        )
      ]
      then_kw:<KW_Then then>
      action:[(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))]
      then_tok:...0x1246
    )
  ]
  else_action:[]
  fi_kw:<KW_Fi fi>
)

===== CASE: -n -c 
if [[ (foo =~ x) ]]; then
  echo hi
fi
 =====


(command.If
  if_kw:<KW_If if>
  arms:[
    (IfArm
      keyword:...0x12d6
      cond:[
        (command.Sentence
          child:(command.DBracket
            left:<KW_DLeftBracket "[[">
            expr:(bool_expr.Binary
              op_id:BoolBinary_EqualTilde
              left:(w <Lit_Chars foo>)
              right:(w <Lit_Chars x>)
            )
            right:<Lit_DRightBracket "]]">
          )
          terminator:<Op_Semi ";">
        )
      ]
      then_kw:<KW_Then then>
      action:[(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))]
      then_tok:...0x125e
    )
  ]
  else_action:[]
  fi_kw:<KW_Fi fi>
)

===== CASE: -n -c 
if [[ ! (" ${params[*]} " =~ " -shared " || " ${params[*]} " =~ " -static ") ]]; then
  echo hi
fi
 =====


(command.If
  if_kw:<KW_If if>
  arms:[
    (IfArm
      keyword:...0x12da
      cond:[
        (command.Sentence
          child:(command.DBracket
            left:<KW_DLeftBracket "[[">
            expr:(bool_expr.LogicalNot
              child:(bool_expr.LogicalOr
                left:(bool_expr.Binary
                  op_id:BoolBinary_EqualTilde
                  left:(w
                    (DQ
                      <Lit_Chars " ">
                      (BracedVarSub
                        left:<Left_DollarBrace "${">
                        name_tok:<VSub_Name params>
                        var_name:params
                        bracket_op:(bracket_op.WholeArray op_id:Arith_Star)
                        right:<Right_DollarBrace "}">
                      )
                      <Lit_Chars " ">
                    )
                  )
                  right:(w (DQ <Lit_Chars " -shared ">))
                )
                right:(bool_expr.Binary
                  op_id:BoolBinary_EqualTilde
                  left:(w
                    (DQ
                      <Lit_Chars " ">
                      (BracedVarSub
                        left:<Left_DollarBrace "${">
                        name_tok:<VSub_Name params>
                        var_name:params
                        bracket_op:(bracket_op.WholeArray op_id:Arith_Star)
                        right:<Right_DollarBrace "}">
                      )
                      <Lit_Chars " ">
                    )
                  )
                  right:(w (DQ <Lit_Chars " -static ">))
                )
              )
            )
            right:<Lit_DRightBracket "]]">
          )
          terminator:<Op_Semi ";">
        )
      ]
      then_kw:<KW_Then then>
      action:[(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))]
      then_tok:...0x11ae
    )
  ]
  else_action:[]
  fi_kw:<KW_Fi fi>
)
OK  test-regex-nix
*** Running test-regex-pipe

===== CASE: -n -c [[ a =~ b|c ]] =====


(command.DBracket
  left:<KW_DLeftBracket "[[">
  expr:(bool_expr.Binary
    op_id:BoolBinary_EqualTilde
    left:(w <Lit_Chars a>)
    right:(w <Lit_Chars b> <Lit_Other "|"> <Lit_Chars c>)
  )
  right:<Lit_DRightBracket "]]">
)
OK  test-regex-pipe
*** Running test-regex-right-paren

===== CASE: -n -c [[ a =~ b ]] =====


(command.DBracket
  left:<KW_DLeftBracket "[[">
  expr:(bool_expr.Binary
    op_id:BoolBinary_EqualTilde
    left:(w <Lit_Chars a>)
    right:(w <Lit_Chars b>)
  )
  right:<Lit_DRightBracket "]]">
)

===== CASE: -n -c [[ a =~ (b) ]] =====


(command.DBracket
  left:<KW_DLeftBracket "[[">
  expr:(bool_expr.Binary
    op_id:BoolBinary_EqualTilde
    left:(w <Lit_Chars a>)
    right:(w
      (word_part.BashRegexGroup
        left:<BashRegex_LParen "(">
        child:(w <Lit_Chars b>)
        right:<Right_BashRegexGroup ")">
      )
    )
  )
  right:<Lit_DRightBracket "]]">
)

===== CASE: -n -c [[ (a =~ b) ]] =====


(command.DBracket
  left:<KW_DLeftBracket "[[">
  expr:(bool_expr.Binary
    op_id:BoolBinary_EqualTilde
    left:(w <Lit_Chars a>)
    right:(w <Lit_Chars b>)
  )
  right:<Lit_DRightBracket "]]">
)

===== CASE: -n -c [[ (a =~ (b)) ]] =====


(command.DBracket
  left:<KW_DLeftBracket "[[">
  expr:(bool_expr.Binary
    op_id:BoolBinary_EqualTilde
    left:(w <Lit_Chars a>)
    right:(w
      (word_part.BashRegexGroup
        left:<BashRegex_LParen "(">
        child:(w <Lit_Chars b>)
        right:<Right_BashRegexGroup ")">
      )
    )
  )
  right:<Lit_DRightBracket "]]">
)

===== CASE: -n -c [[ (a =~ ( =====


  [[ (a =~ (
            ^
[ -c flag ]:1: Expected word after ( opening bash regex group

===== CASE: -n -c [[ (a =~ (b =====


  [[ (a =~ (b
             ^
[ -c flag ]:1: Expected ) to close bash regex group
OK  test-regex-right-paren
*** Running test-regex-space

===== CASE: -n -c [[ a =~ ( ) ]] =====


(command.DBracket
  left:<KW_DLeftBracket "[[">
  expr:(bool_expr.Binary
    op_id:BoolBinary_EqualTilde
    left:(w <Lit_Chars a>)
    right:(w
      (word_part.BashRegexGroup
        left:<BashRegex_LParen "(">
        child:(w <Lit_Chars " ">)
        right:<Right_BashRegexGroup ")">
      )
    )
  )
  right:<Lit_DRightBracket "]]">
)

===== CASE: -n -c [[ a =~ (b c) ]] =====


(command.DBracket
  left:<KW_DLeftBracket "[[">
  expr:(bool_expr.Binary
    op_id:BoolBinary_EqualTilde
    left:(w <Lit_Chars a>)
    right:(w
      (word_part.BashRegexGroup
        left:<BashRegex_LParen "(">
        child:(w <Lit_Chars b> <Lit_Chars " "> <Lit_Chars c>)
        right:<Right_BashRegexGroup ")">
      )
    )
  )
  right:<Lit_DRightBracket "]]">
)

===== CASE: -n -c [[ a =~ (a b)(c d) ]] =====


(command.DBracket
  left:<KW_DLeftBracket "[[">
  expr:(bool_expr.Binary
    op_id:BoolBinary_EqualTilde
    left:(w <Lit_Chars a>)
    right:(w
      (word_part.BashRegexGroup
        left:<BashRegex_LParen "(">
        child:(w <Lit_Chars a> <Lit_Chars " "> <Lit_Chars b>)
        right:<Right_BashRegexGroup ")">
      )
      (word_part.BashRegexGroup
        left:<BashRegex_LParen "(">
        child:(w <Lit_Chars c> <Lit_Chars " "> <Lit_Chars d>)
        right:<Right_BashRegexGroup ")">
      )
    )
  )
  right:<Lit_DRightBracket "]]">
)
bash=0

===== CASE: -n -c [[ a =~ (b
c) ]] =====


(command.DBracket
  left:<KW_DLeftBracket "[[">
  expr:(bool_expr.Binary
    op_id:BoolBinary_EqualTilde
    left:(w <Lit_Chars a>)
    right:(w
      (word_part.BashRegexGroup
        left:<BashRegex_LParen "(">
        child:(w <Lit_Chars b> <Lit_Chars "\n"> <Lit_Chars c>)
        right:<Right_BashRegexGroup ")">
      )
    )
  )
  right:<Lit_DRightBracket "]]">
)
OK  test-regex-space
*** Running test-shell_for

===== CASE: -n -c for x in & =====


  for x in &
           ^
[ -c flag ]:1: Invalid word in for loop

===== CASE: -n -c for (( i=0; i<10; i++ )) ls =====


  for (( i=0; i<10; i++ )) ls
                           ^~
[ -c flag ]:1: Invalid word after for expression

===== CASE: -n -c for ( i=0; i<10; i++ ) =====


  for ( i=0; i<10; i++ )
      ^
[ -c flag ]:1: Expected loop variable (a constant word)

===== CASE: -n -c for $x in 1 2 3; do echo $i; done =====


  for $x in 1 2 3; do echo $i; done
      ^~
[ -c flag ]:1: Expected loop variable (a constant word)

===== CASE: -n -c for x.y in 1 2 3; do echo $i; done =====


  for x.y in 1 2 3; do echo $i; done
      ^~~
[ -c flag ]:1: Invalid loop variable name 'x.y'

===== CASE: -n -c for x in 1 2 3; & =====


  for x in 1 2 3; &
                  ^
[ -c flag ]:1: Expected word type Id.KW_Do, got Id.Op_Amp

===== CASE: -n -c for foo BAD =====


  for foo BAD
             ^
[ -c flag ]:1: Expected loop variable (a constant word)

===== CASE: -n -c for var in x; do echo $var; done =====


(command.ForEach
  keyword:<KW_For for>
  iter_names:[var]
  iterable:(for_iter.Words words:[(w <Lit_Chars x>)])
  semi_tok:<Op_Semi ";">
  body:(command.DoGroup
    left:<KW_Do do>
    children:[
      (command.Sentence
        child:(C (w <Lit_Chars echo>) (w ($ var)))
        terminator:<Op_Semi ";">
      )
    ]
    right:<KW_Done done>
  )
)
OK  test-shell_for
*** Running test-simple-command

===== CASE: -n -c PYTHONPATH=. FOO=(1 2) python =====


  PYTHONPATH=. FOO=(1 2) python
               ^~~~
[ -c flag ]:1: Environment bindings can't contain array literals

===== CASE: -n -c PYTHONPATH+=1 python =====


  PYTHONPATH+=1 python
  ^~~~~~~~~~~~
[ -c flag ]:1: Expected = in environment binding, got +=

===== CASE: -n -c =var =====


  =var
  ^
[ -c flag ]:1: =word isn't allowed.  Hint: add a space after =, or quote it

===== CASE: -n -c =f(x) =====


  =f(x)
  ^
[ -c flag ]:1: =word isn't allowed.  Hint: add a space after =, or quote it

===== CASE: -n -c =var =====


  =var
  ^
[ -c flag ]:1: =word isn't allowed.  Hint: add a space after =, or quote it

===== CASE: -n -c =f(x) =====


  =f(x)
  ^
[ -c flag ]:1: =word isn't allowed.  Hint: add a space after =, or quote it
OK  test-simple-command
*** Running test-slice

===== CASE: -n -c ${foo:42} =====


(C
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name foo>
      var_name:foo
      suffix_op:(suffix_op.Slice begin:(w <Lit_Digits 42>))
      right:<Arith_RBrace "}">
    )
  )
)

===== CASE: -n -c ${foo:42+1} =====


(C
  (w
    (BracedVarSub
      left:<Left_DollarBrace "${">
      name_tok:<VSub_Name foo>
      var_name:foo
      suffix_op:(suffix_op.Slice
        begin:(arith_expr.Binary
          op:<Arith_Plus "+">
          left:(w <Lit_Digits 42>)
          right:(w <Lit_Digits 1>)
        )
      )
      right:<Arith_RBrace "}">
    )
  )
)

===== CASE: -n -c echo ${a:1;} =====


  echo ${a:1;}
            ^
[ -c flag ]:1: Expected : or } in slice

===== CASE: -n -c echo ${a:1:2;} =====


  echo ${a:1:2;}
              ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RBrace)
OK  test-slice
*** Running test-syntax-abbrev

===== CASE: -n -c echo "double $x ${braced}" $(date) =====


(C
  (w <Lit_Chars echo>)
  (w (DQ <Lit_Chars "double "> ($ x) <Lit_Chars " "> (${ VSub_Name braced)))
  (w
    (CommandSub
      left_token:<Left_DollarParen "$(">
      child:(C (w <Lit_Chars date>))
      right:<Eof_RParen ")">
    )
  )
)
(command.Simple
  blame_tok:(Token
    id:Lit_Chars
    length:4
    col:0
    line:(SourceLine
      line_num:1
      content:"echo \"double $x ${braced}\" $(date)"
      src:(source.CFlag)
    )
  )
  more_env:[]
  words:[
    (CompoundWord parts:[...0x12da])
    (CompoundWord
      parts:[
        (DoubleQuoted
          left:(Token id:Left_DoubleQuote length:1 col:5 line:...0x12e2)
          parts:[
            (Token id:Lit_Chars length:7 col:6 line:...0x12e2)
            (SimpleVarSub
              tok:(Token id:VSub_DollarName length:2 col:13 line:...0x12e2)
            )
            (Token id:Lit_Chars length:1 col:15 line:...0x12e2)
            (BracedVarSub
              left:(Token id:Left_DollarBrace length:2 col:16 line:...0x12e2)
              name_tok:(Token id:VSub_Name length:6 col:18 line:...0x12e2)
              var_name:braced
              right:(Token id:Right_DollarBrace length:1 col:24 line:...0x12e2)
            )
          ]
          right:(Token id:Right_DoubleQuote length:1 col:25 line:...0x12e2)
        )
      ]
    )
    (CompoundWord
      parts:[
        (CommandSub
          left_token:(Token id:Left_DollarParen length:2 col:27 line:...0x12e2)
          child:(command.Simple
            blame_tok:(Token id:Lit_Chars length:4 col:29 line:...0x12e2)
            more_env:[]
            words:[(CompoundWord parts:[...0x1286])]
            is_last_cmd:F
          )
          right:(Token id:Eof_RParen length:1 col:33 line:...0x12e2)
        )
      ]
    )
  ]
  is_last_cmd:F
)

===== CASE: -n -c echo 'single' =====


(C (w <Lit_Chars echo>) (w (SQ single)))
(command.Simple
  blame_tok:(Token
    id:Lit_Chars
    length:4
    col:0
    line:(SourceLine line_num:1 content:"echo 'single'" src:(source.CFlag))
  )
  more_env:[]
  words:[
    (CompoundWord parts:[...0x12d2])
    (CompoundWord
      parts:[
        (SingleQuoted
          left:(Token id:Left_SingleQuote length:1 col:5 line:...0x12da)
          sval:single
          right:(Token id:Right_SingleQuote length:1 col:12 line:...0x12da)
        )
      ]
    )
  ]
  is_last_cmd:F
)

===== CASE: -n -c var x = i + 42; =====


(command.Sentence
  child:(command.VarDecl
    keyword:<KW_Var var>
    lhs:[(NameType left:<Expr_Name x> name:x)]
    rhs:(expr.Binary
      op:<Arith_Plus "+">
      left:(Var i)
      right:(Const Expr_DecInt _)
    )
  )
  terminator:<Op_Semi ";">
)
(command.Sentence
  child:(command.VarDecl
    keyword:(Token
      id:KW_Var
      length:3
      col:0
      line:(SourceLine line_num:1 content:"var x = i + 42;" src:(source.CFlag))
    )
    lhs:[
      (NameType
        left:(Token id:Expr_Name length:1 col:4 line:...0x7efdd99c37e0)
        name:x
      )
    ]
    rhs:(expr.Binary
      op:(Token id:Arith_Plus length:1 col:10 line:...0x7efdd99c37e0)
      left:(expr.Var
        left:(Token id:Expr_Name length:1 col:8 line:...0x7efdd99c37e0)
        name:i
      )
      right:(expr.Const
        c:(Token id:Expr_DecInt length:2 col:12 line:...0x7efdd99c37e0)
        val:(value.Int i:42)
      )
    )
  )
  terminator:(Token id:Op_Semi length:1 col:14 line:...0x7efdd99c37e0)
)
OK  test-syntax-abbrev
*** Running test-test-builtin

===== CASE: -c [ x -a y f ] =====


  [ x -a y f ]
           ^
[ -c flag ]:1: (test) Unexpected trailing word 'f'

===== CASE: -c test x -a y f =====


  test x -a y f
              ^
[ -c flag ]:1: (test) Unexpected trailing word 'f'

===== CASE: -c [ x  =====


  [ x
  ^
[ -c flag ]:1: missing closing ]

===== CASE: -c [ x x ] =====


  [ x x ]
    ^
[ -c flag ]:1: (test) Expected unary operator, got 'x' (2 args)

===== CASE: -c [ x x "a b" ] =====


  [ x x "a b" ]
      ^
[ -c flag ]:1: (test) Expected binary operator, got 'x' (3 args)

===== CASE: -c [ -t xxx ] =====


  [ -t xxx ]
       ^~~
[ -c flag ]:1: (test) Invalid file descriptor 'xxx'

===== CASE: -c [ \( x -a -y -a z ] =====


[??? no location ???] (test) Expected ), got EOF
OK  test-test-builtin
*** Running test-word-parse

===== CASE: -n -c echo ${ =====


  echo ${
         ^
[ -c flag ]:1: Unexpected token in ${}

===== CASE: -n -c echo ${a[@Z =====


  echo ${a[@Z
            ^
[ -c flag ]:1: Expected ] to close subscript

===== CASE: -n -c echo ${x.} =====


  echo ${x.}
          ^
[ -c flag ]:1: Expected } to close ${

===== CASE: -n -c echo ${!x.} =====


  echo ${!x.}
           ^
[ -c flag ]:1: Expected } to close ${

===== CASE: -n -c echo ${#a. =====


  echo ${#a.
           ^
[ -c flag ]:1: Expected } after length expression

===== CASE: -n -c for (( i = 0; i < 10; i++ ; =====


  for (( i = 0; i < 10; i++ ;
                            ^
[ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RParen)

===== CASE: -n -c for (( i = 0; i < 10; i++ / =====


  for (( i = 0; i < 10; i++ /
                             ^
[ -c flag ]:1: Unexpected end of input

===== CASE: -n -c echo @(extglob|foo =====


  echo @(extglob|foo
       ^~
[ -c flag ]:1: Unexpected EOF reading extended glob that began here

===== CASE: -n -c ${undef:- =====


  ${undef:-
           ^
[ -c flag ]:1: Expected } to close ${

===== CASE: -n -c ${undef:-$ =====


  ${undef:-$
            ^
[ -c flag ]:1: Expected } to close ${

===== CASE: -n -c ${undef:-$F =====


  ${undef:-$F
             ^
[ -c flag ]:1: Expected } to close ${

===== CASE: -n -c ${x@ =====


  ${x@
     ^
[ -c flag ]:1: Unexpected token in ${} (VOp3)

===== CASE: -n -c ${x@Q =====


  ${x@Q
       ^
[ -c flag ]:1: Expected } to close ${

===== CASE: -n -c ${x% =====


  ${x%
      ^
[ -c flag ]:1: Expected } to close ${

===== CASE: -n -c ${x/ =====


  ${x/
      ^
[ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real

===== CASE: -n -c ${x/a/ =====


  ${x/a/
        ^
[ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real

===== CASE: -n -c ${x/a/b =====


  ${x/a/b
         ^
[ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real

===== CASE: -n -c ${x: =====


  ${x:
      ^
[ -c flag ]:1: Unexpected end of input
OK  test-word-parse

test/parse-errors.sh: 37 tests passed.