(command.CommandList
  children: [
    (C {(KW_Set set)} {(-e)})
    (C {(KW_Set set)} {(-E)})
    (C {(KW_Set set)} {(-T)})
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:BATS_COUNT_ONLY) op:Equal rhs:{(DQ )})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {(DQ ($ VSub_Number '$1'))} {(Lit_Equals '=')} {(DQ (-c))} 
                  {(Lit_RBracket ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:BATS_COUNT_ONLY) op:Equal rhs:{(1)})]
            )
            (C {(shift)})
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:BATS_EXTENDED_SYNTAX) op:Equal rhs:{(DQ )})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {(DQ ($ VSub_Number '$1'))} {(Lit_Equals '=')} {(DQ (-x))} 
                  {(Lit_RBracket ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_EXTENDED_SYNTAX)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (C {(shift)})
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BATS_TEST_FILENAME)
          op: Equal
          rhs: {(DQ ($ VSub_Number '$1'))}
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {(-z)} {(DQ ($ VSub_DollarName '$BATS_TEST_FILENAME'))} 
                  {(Lit_RBracket ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Simple
              words: [{(echo)} {(DQ ('usage: bats-exec <filename>'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {(KW_Bang '!')} {(-f)} 
                  {(DQ ($ VSub_DollarName '$BATS_TEST_FILENAME'))} {(Lit_RBracket ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Simple
              words: [
                {(echo)}
                {(DQ ('bats: ') ($ VSub_DollarName '$BATS_TEST_FILENAME') (' does not exist'))}
              ]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
      else_action: [(C {(shift)})]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BATS_TEST_DIRNAME)
          op: Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Left_DollarParen '$('>
                  command_list: 
                    (command.CommandList
                      children: [(C {(dirname)} {(DQ ($ VSub_DollarName '$BATS_TEST_FILENAME'))})]
                    )
                )
              )
            }
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BATS_TEST_NAMES)
          op: Equal
          rhs: {(sh_array_literal left:<Op_LParen '('>)}
        )
      ]
    )
    (command.ShFunction
      name: load
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'name=') (DQ ($ VSub_Number '$1'))})
            (C {(local)} {(filename)})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} 
                          {
                            (DQ 
                              (braced_var_sub
                                token: <VSub_Name name>
                                suffix_op: 
                                  (suffix_op.Slice
                                    begin: (arith_expr.ArithWord w:{(Lit_Digits 0)})
                                    length: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                                  )
                              )
                            )
                          } {(Lit_Equals '=')} {(DQ (/))} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:filename)
                          op: Equal
                          rhs: {(DQ (${ VSub_Name name))}
                        )
                      ]
                    )
                  ]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:filename)
                      op: Equal
                      rhs: 
                        {
                          (DQ ($ VSub_DollarName '$BATS_TEST_DIRNAME') (/) (${ VSub_Name name) (.bash))
                        }
                    )
                  ]
                )
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(Lit_LBracket '[')} {(-f)} {(DQ ($ VSub_DollarName '$filename'))} 
                  {(Lit_RBracket ']')}
                )
                (command.BraceGroup
                  children: [
                    (command.Simple
                      words: [
                        {(echo)}
                        {(DQ ('bats: ') ($ VSub_DollarName '$filename') (' does not exist'))}
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                    (command.ControlFlow
                      token: <ControlFlow_Exit exit>
                      arg_word: {(1)}
                    )
                  ]
                )
              ]
            )
            (C {(source)} {(DQ (${ VSub_Name filename))})
          ]
        )
    )
    (command.ShFunction
      name: run
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(e)} {(E)} {(T)} {(oldIFS)})
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalNot
                      child: 
                        (bool_expr.Binary
                          op_id: BoolBinary_EqualTilde
                          left: {(DQ ($ VSub_Hyphen '$-'))}
                          right: {(e)}
                        )
                    )
                )
                (command.ShAssignment
                  pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:e) op:Equal rhs:{(1)})]
                )
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalNot
                      child: 
                        (bool_expr.Binary
                          op_id: BoolBinary_EqualTilde
                          left: {(DQ ($ VSub_Hyphen '$-'))}
                          right: {(E)}
                        )
                    )
                )
                (command.ShAssignment
                  pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:E) op:Equal rhs:{(1)})]
                )
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalNot
                      child: 
                        (bool_expr.Binary
                          op_id: BoolBinary_EqualTilde
                          left: {(DQ ($ VSub_Hyphen '$-'))}
                          right: {(T)}
                        )
                    )
                )
                (command.ShAssignment
                  pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:T) op:Equal rhs:{(1)})]
                )
              ]
            )
            (C {(KW_Set set)} {(Lit_Other '+') (e)})
            (C {(KW_Set set)} {(Lit_Other '+') (E)})
            (C {(KW_Set set)} {(Lit_Other '+') (T)})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:output)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Left_DollarParen '$('>
                          command_list: 
                            (command.CommandList
                              children: [
                                (command.Simple
                                  words: [{(DQ ($ VSub_At '$@'))}]
                                  redirects: [
                                    (redir.Redir
                                      op: <Redir_GreatAnd '2>&'>
                                      fd: 2
                                      arg_word: {(1)}
                                    )
                                  ]
                                )
                              ]
                            )
                        )
                      )
                    }
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:status)
                  op: Equal
                  rhs: {(DQ ($ VSub_QMark '$?'))}
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:oldIFS)
                  op: Equal
                  rhs: {($ VSub_DollarName '$IFS')}
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:IFS)
                  op: Equal
                  rhs: {(single_quoted left:<Left_SingleQuoteC "$'"> tokens:[<Char_OneChar '\\n'>])}
                )
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:lines)
                  op: Equal
                  rhs: 
                    {(sh_array_literal left:<Op_LParen '('> words:[{($ VSub_DollarName '$output')}])}
                )
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(Lit_LBracket '[')} {(-z)} {(DQ ($ VSub_DollarName '$e'))} {(Lit_RBracket ']')})
                (C {(KW_Set set)} {(-e)})
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(Lit_LBracket '[')} {(-z)} {(DQ ($ VSub_DollarName '$E'))} {(Lit_RBracket ']')})
                (C {(KW_Set set)} {(-E)})
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(Lit_LBracket '[')} {(-z)} {(DQ ($ VSub_DollarName '$T'))} {(Lit_RBracket ']')})
                (C {(KW_Set set)} {(-T)})
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:IFS)
                  op: Equal
                  rhs: {($ VSub_DollarName '$oldIFS')}
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction name:setup body:(command.BraceGroup children:[(C {(true)})]))
    (command.ShFunction name:teardown body:(command.BraceGroup children:[(C {(true)})]))
    (command.ShFunction
      name: skip
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_TEST_SKIPPED)
                  op: Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <VSub_Number 1>
                        suffix_op: (suffix_op.Unary op_id:VTest_ColonHyphen arg_word:{(1)})
                      )
                    }
                )
              ]
            )
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:BATS_TEST_COMPLETED) op:Equal rhs:{(1)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})
          ]
        )
    )
    (command.ShFunction
      name: bats_test_begin
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_TEST_DESCRIPTION)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-n)} {(DQ ($ VSub_DollarName '$BATS_EXTENDED_SYNTAX'))} 
                          {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [
                        {(echo)}
                        {
                          (DQ ('begin ') ($ VSub_DollarName '$BATS_TEST_NUMBER') (' ') 
                            ($ VSub_DollarName '$BATS_TEST_DESCRIPTION')
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(3)})]
                    )
                  ]
                )
              ]
            )
            (C {(setup)})
          ]
        )
    )
    (command.ShFunction
      name: bats_test_function
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'test_name=') (DQ ($ VSub_Number '$1'))})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: 
                    (sh_lhs_expr.IndexedName
                      name: BATS_TEST_NAMES
                      index: 
                        (arith_expr.ArithWord
                          w: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <VSub_Name BATS_TEST_NAMES>
                                  prefix_op: VSub_Pound
                                  bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                                )
                              )
                            }
                        )
                    )
                  op: Equal
                  rhs: {(DQ ($ VSub_DollarName '$test_name'))}
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_capture_stack_trace
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_PREVIOUS_STACK_TRACE)
                  op: Equal
                  rhs: 
                    {
                      (sh_array_literal
                        left: <Op_LParen '('>
                        words: [
                          {
                            (DQ 
                              (braced_var_sub
                                token: <VSub_Name BATS_CURRENT_STACK_TRACE>
                                bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                              )
                            )
                          }
                        ]
                      )
                    }
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_CURRENT_STACK_TRACE)
                  op: Equal
                  rhs: {(sh_array_literal left:<Op_LParen '('>)}
                )
              ]
            )
            (C {(local)} 
              {(Lit_VarLike 'test_pattern=') 
                (DQ (' ') ($ VSub_DollarName '$BATS_TEST_NAME') (' ') 
                  ($ VSub_DollarName '$BATS_TEST_SOURCE')
                )
              }
            )
            (C {(local)} 
              {(Lit_VarLike 'setup_pattern=') (DQ (' setup ') ($ VSub_DollarName '$BATS_TEST_SOURCE'))}
            )
            (C {(local)} 
              {(Lit_VarLike 'teardown_pattern=') 
                (DQ (' teardown ') ($ VSub_DollarName '$BATS_TEST_SOURCE'))
              }
            )
            (C {(local)} {(frame)})
            (C {(local)} {(Lit_VarLike 'index=') (1)})
            (command.WhileUntil
              keyword: <KW_While while>
              cond: [
                (command.Sentence
                  child: 
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:frame)
                          op: Equal
                          rhs: 
                            {
                              (DQ 
                                (command_sub
                                  left_token: <Left_DollarParen '$('>
                                  command_list: 
                                    (command.CommandList
                                      children: [(C {(caller)} {(DQ ($ VSub_DollarName '$index'))})]
                                    )
                                )
                              )
                            }
                        )
                      ]
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: 
                            (sh_lhs_expr.IndexedName
                              name: BATS_CURRENT_STACK_TRACE
                              index: 
                                (arith_expr.ArithWord
                                  w: 
                                    {
                                      (DQ 
                                        (braced_var_sub
                                          token: <VSub_Name BATS_CURRENT_STACK_TRACE>
                                          prefix_op: VSub_Pound
                                          bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                                        )
                                      )
                                    }
                                )
                            )
                          op: Equal
                          rhs: {(DQ ($ VSub_DollarName '$frame'))}
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.LogicalOr
                                      left: 
                                        (bool_expr.Binary
                                          op_id: BoolBinary_GlobEqual
                                          left: {(DQ ($ VSub_DollarName '$frame'))}
                                          right: 
                                            {(Lit_Other '*') (DQ ($ VSub_DollarName '$test_pattern'))}
                                        )
                                      right: 
                                        (bool_expr.LogicalOr
                                          left: 
                                            (bool_expr.Binary
                                              op_id: BoolBinary_GlobEqual
                                              left: {(DQ ($ VSub_DollarName '$frame'))}
                                              right: 
                                                {(Lit_Other '*') 
                                                  (DQ ($ VSub_DollarName '$setup_pattern'))
                                                }
                                            )
                                          right: 
                                            (bool_expr.Binary
                                              op_id: BoolBinary_GlobEqual
                                              left: {(DQ ($ VSub_DollarName '$frame'))}
                                              right: 
                                                {(Lit_Other '*') 
                                                  (DQ ($ VSub_DollarName '$teardown_pattern'))
                                                }
                                            )
                                        )
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(command.ControlFlow token:<ControlFlow_Break break>)]
                        )
                      ]
                      else_action: [(C {(let)} {(Lit_VarLike 'index+=') (1)})]
                    )
                  ]
                )
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_SOURCE)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Left_DollarParen '$('>
                          command_list: 
                            (command.CommandList
                              children: [
                                (C {(bats_frame_filename)} 
                                  {
                                    (DQ 
                                      (braced_var_sub
                                        token: <VSub_Name BATS_CURRENT_STACK_TRACE>
                                        bracket_op: 
                                          (bracket_op.ArrayIndex
                                            expr: (arith_expr.ArithWord w:{(Lit_Digits 0)})
                                          )
                                      )
                                    )
                                  }
                                )
                              ]
                            )
                        )
                      )
                    }
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_LINENO)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Left_DollarParen '$('>
                          command_list: 
                            (command.CommandList
                              children: [
                                (C {(bats_frame_lineno)} 
                                  {
                                    (DQ 
                                      (braced_var_sub
                                        token: <VSub_Name BATS_CURRENT_STACK_TRACE>
                                        bracket_op: 
                                          (bracket_op.ArrayIndex
                                            expr: (arith_expr.ArithWord w:{(Lit_Digits 0)})
                                          )
                                      )
                                    )
                                  }
                                )
                              ]
                            )
                        )
                      )
                    }
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_print_stack_trace
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(frame)})
            (C {(local)} {(Lit_VarLike 'index=') (1)})
            (C {(local)} 
              {(Lit_VarLike 'count=') (DQ (braced_var_sub token:<VSub_At '@'> prefix_op:VSub_Pound))}
            )
            (command.ForEach
              iter_name: frame
              iter_words: [{(DQ ($ VSub_At '$@'))}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (C {(local)} 
                      {(Lit_VarLike 'filename=') 
                        (DQ 
                          (command_sub
                            left_token: <Left_DollarParen '$('>
                            command_list: 
                              (command.CommandList
                                children: [
                                  (C {(bats_trim_filename)} 
                                    {
                                      (DQ 
                                        (command_sub
                                          left_token: <Left_DollarParen '$('>
                                          command_list: 
                                            (command.CommandList
                                              children: [
                                                (C {(bats_frame_filename)} 
                                                  {(DQ ($ VSub_DollarName '$frame'))}
                                                )
                                              ]
                                            )
                                        )
                                      )
                                    }
                                  )
                                ]
                              )
                          )
                        )
                      }
                    )
                    (C {(local)} 
                      {(Lit_VarLike 'lineno=') 
                        (DQ 
                          (command_sub
                            left_token: <Left_DollarParen '$('>
                            command_list: 
                              (command.CommandList
                                children: [(C {(bats_frame_lineno)} {(DQ ($ VSub_DollarName '$frame'))})]
                              )
                          )
                        )
                      }
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_LBracket '[')} {($ VSub_DollarName '$index')} {(-eq)} {(1)} 
                                  {(Lit_RBracket ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(C {(echo)} {(-n)} {(DQ ('# ('))})]
                        )
                      ]
                      else_action: [(C {(echo)} {(-n)} {(DQ ('#  '))})]
                    )
                    (C {(local)} 
                      {(Lit_VarLike 'fn=') 
                        (DQ 
                          (command_sub
                            left_token: <Left_DollarParen '$('>
                            command_list: 
                              (command.CommandList
                                children: [
                                  (C {(bats_frame_function)} {(DQ ($ VSub_DollarName '$frame'))})
                                ]
                              )
                          )
                        )
                      }
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$fn'))} 
                                  {(KW_Bang '!') (Lit_Equals '=')} {(DQ ($ VSub_DollarName '$BATS_TEST_NAME'))} {(Lit_RBracket ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} {(-n)} 
                              {
                                (DQ ('from function ') 
                                  (word_part.EscapedLiteral
                                    token: <Lit_EscapedChar '\\`'>
                                  ) ($ VSub_DollarName '$fn') ("' ")
                                )
                              }
                            )
                          ]
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_LBracket '[')} {($ VSub_DollarName '$index')} {(-eq)} 
                                  {($ VSub_DollarName '$count')} {(Lit_RBracket ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} 
                              {
                                (DQ ('in test file ') ($ VSub_DollarName '$filename') (', line ') 
                                  ($ VSub_DollarName '$lineno') (')')
                                )
                              }
                            )
                          ]
                        )
                      ]
                      else_action: [
                        (C {(echo)} 
                          {
                            (DQ ('in file ') ($ VSub_DollarName '$filename') (', line ') 
                              ($ VSub_DollarName '$lineno') (',')
                            )
                          }
                        )
                      ]
                    )
                    (C {(let)} {(Lit_VarLike 'index+=') (1)})
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_print_failed_command
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'frame=') (DQ ($ VSub_Number '$1'))})
            (C {(local)} {(Lit_VarLike 'status=') (DQ ($ VSub_Number '$2'))})
            (C {(local)} 
              {(Lit_VarLike 'filename=') 
                (DQ 
                  (command_sub
                    left_token: <Left_DollarParen '$('>
                    command_list: 
                      (command.CommandList
                        children: [(C {(bats_frame_filename)} {(DQ ($ VSub_DollarName '$frame'))})]
                      )
                  )
                )
              }
            )
            (C {(local)} 
              {(Lit_VarLike 'lineno=') 
                (DQ 
                  (command_sub
                    left_token: <Left_DollarParen '$('>
                    command_list: 
                      (command.CommandList
                        children: [(C {(bats_frame_lineno)} {(DQ ($ VSub_DollarName '$frame'))})]
                      )
                  )
                )
              }
            )
            (C {(local)} 
              {(Lit_VarLike 'failed_line=') 
                (DQ 
                  (command_sub
                    left_token: <Left_DollarParen '$('>
                    command_list: 
                      (command.CommandList
                        children: [
                          (C {(bats_extract_line)} {(DQ ($ VSub_DollarName '$filename'))} 
                            {(DQ ($ VSub_DollarName '$lineno'))}
                          )
                        ]
                      )
                  )
                )
              }
            )
            (C {(local)} 
              {(Lit_VarLike 'failed_command=') 
                (DQ 
                  (command_sub
                    left_token: <Left_DollarParen '$('>
                    command_list: 
                      (command.CommandList
                        children: [(C {(bats_strip_string)} {(DQ ($ VSub_DollarName '$failed_line'))})]
                      )
                  )
                )
              }
            )
            (C {(echo)} {(-n)} 
              {
                (DQ ('#   ') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\`'>) 
                  (${ VSub_Name failed_command) ("' ")
                )
              }
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {($ VSub_DollarName '$status')} {(-eq)} {(1)} 
                          {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(echo)} {(DQ (failed))})]
                )
              ]
              else_action: [(C {(echo)} {(DQ ('failed with status ') ($ VSub_DollarName '$status'))})]
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_frame_lineno
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'frame=') (DQ ($ VSub_Number '$1'))})
            (C {(local)} 
              {(Lit_VarLike 'lineno=') 
                (DQ 
                  (braced_var_sub
                    token: <VSub_Name frame>
                    suffix_op: (suffix_op.Unary op_id:VOp1_DPercent arg_word:{(' *')})
                  )
                )
              }
            )
            (C {(echo)} {(DQ ($ VSub_DollarName '$lineno'))})
          ]
        )
    )
    (command.ShFunction
      name: bats_frame_function
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'frame=') (DQ ($ VSub_Number '$1'))})
            (C {(local)} 
              {(Lit_VarLike 'rest=') 
                (DQ 
                  (braced_var_sub
                    token: <VSub_Name frame>
                    suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{('* ')})
                  )
                )
              }
            )
            (C {(local)} 
              {(Lit_VarLike 'fn=') 
                (DQ 
                  (braced_var_sub
                    token: <VSub_Name rest>
                    suffix_op: (suffix_op.Unary op_id:VOp1_DPercent arg_word:{(' *')})
                  )
                )
              }
            )
            (C {(echo)} {(DQ ($ VSub_DollarName '$fn'))})
          ]
        )
    )
    (command.ShFunction
      name: bats_frame_filename
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'frame=') (DQ ($ VSub_Number '$1'))})
            (C {(local)} 
              {(Lit_VarLike 'rest=') 
                (DQ 
                  (braced_var_sub
                    token: <VSub_Name frame>
                    suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{('* ')})
                  )
                )
              }
            )
            (C {(local)} 
              {(Lit_VarLike 'filename=') 
                (DQ 
                  (braced_var_sub
                    token: <VSub_Name rest>
                    suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{('* ')})
                  )
                )
              }
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$filename'))} 
                          {(Lit_Equals '=')} {(DQ ($ VSub_DollarName '$BATS_TEST_SOURCE'))} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(echo)} {(DQ ($ VSub_DollarName '$BATS_TEST_FILENAME'))})]
                )
              ]
              else_action: [(C {(echo)} {(DQ ($ VSub_DollarName '$filename'))})]
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_extract_line
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'filename=') (DQ ($ VSub_Number '$1'))})
            (C {(local)} {(Lit_VarLike 'lineno=') (DQ ($ VSub_Number '$2'))})
            (C {(sed)} {(-n)} {(DQ (${ VSub_Name lineno) (p))} {(DQ ($ VSub_DollarName '$filename'))})
          ]
        )
    )
    (command.ShFunction
      name: bats_strip_string
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'string=') (DQ ($ VSub_Number '$1'))})
            (command.Pipeline
              children: [
                (C {(printf)} {(DQ ('%s'))} {(DQ ($ VSub_DollarName '$string'))})
                (C {(sed)} {(-e)} 
                  {(DQ ('s/^[ ')) 
                    (single_quoted
                      left: <Left_SingleQuoteC "$'">
                      tokens: [<Char_OneChar '\\t'>]
                    ) (DQ (']*//'))
                  } {(-e)} 
                  {(DQ ('s/[ ')) 
                    (single_quoted
                      left: <Left_SingleQuoteC "$'">
                      tokens: [<Char_OneChar '\\t'>]
                    ) (DQ (']*') (Lit_Other '$') (//))
                  }
                )
              ]
              negated: F
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_trim_filename
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'filename=') (DQ ($ VSub_Number '$1'))})
            (C {(local)} 
              {(Lit_VarLike 'length=') 
                (DQ (braced_var_sub token:<VSub_Name BATS_CWD> prefix_op:VSub_Pound))
              }
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} 
                          {
                            (DQ 
                              (braced_var_sub
                                token: <VSub_Name filename>
                                suffix_op: 
                                  (suffix_op.Slice
                                    begin: (arith_expr.ArithWord w:{(Lit_Digits 0)})
                                    length: 
                                      (arith_expr.Binary
                                        op_id: Arith_Plus
                                        left: (arith_expr.VarRef token:<Lit_ArithVarLike length>)
                                        right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                                      )
                                  )
                              )
                            )
                          } {(Lit_Equals '=')} {(DQ (${ VSub_Name BATS_CWD) (/))} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ 
                          (braced_var_sub
                            token: <VSub_Name filename>
                            suffix_op: 
                              (suffix_op.Slice
                                begin: 
                                  (arith_expr.Binary
                                    op_id: Arith_Plus
                                    left: (arith_expr.VarRef token:<Lit_ArithVarLike length>)
                                    right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                                  )
                              )
                          )
                        )
                      }
                    )
                  ]
                )
              ]
              else_action: [(C {(echo)} {(DQ ($ VSub_DollarName '$filename'))})]
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_debug_trap
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(DQ ($ VSub_DollarName '$BASH_SOURCE'))} 
                          {(KW_Bang '!') (Lit_Equals '=')} {(DQ ($ VSub_Number '$1'))} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(bats_capture_stack_trace)})]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_error_trap
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_ERROR_STATUS)
                  op: Equal
                  rhs: {(DQ ($ VSub_QMark '$?'))}
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_ERROR_STACK_TRACE)
                  op: Equal
                  rhs: 
                    {
                      (sh_array_literal
                        left: <Op_LParen '('>
                        words: [
                          {
                            (DQ 
                              (braced_var_sub
                                token: <VSub_Name BATS_PREVIOUS_STACK_TRACE>
                                bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                              )
                            )
                          }
                        ]
                      )
                    }
                )
              ]
            )
            (C {(trap)} {(-)} {(debug)})
          ]
        )
    )
    (command.ShFunction
      name: bats_teardown_trap
      body: 
        (command.BraceGroup
          children: [
            (C {(trap)} {(DQ (bats_exit_trap))} {(ControlFlow_Exit exit)})
            (C {(local)} {(Lit_VarLike 'status=') (0)})
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (command.Simple
                  words: [{(teardown)}]
                  redirects: [
                    (redir.Redir
                      op: <Redir_DGreat '>>'>
                      fd: 16777215
                      arg_word: {(DQ ($ VSub_DollarName '$BATS_OUT'))}
                    )
                    (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:status)
                      op: Equal
                      rhs: {(DQ ($ VSub_QMark '$?'))}
                    )
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {($ VSub_DollarName '$status')} {(-eq)} {(0)} 
                          {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:BATS_TEARDOWN_COMPLETED)
                          op: Equal
                          rhs: {(1)}
                        )
                      ]
                    )
                  ]
                )
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-n)} {(DQ ($ VSub_DollarName '$BATS_TEST_COMPLETED'))} 
                          {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:BATS_ERROR_STATUS)
                          op: Equal
                          rhs: {(DQ ($ VSub_DollarName '$status'))}
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:BATS_ERROR_STACK_TRACE)
                          op: Equal
                          rhs: 
                            {
                              (sh_array_literal
                                left: <Op_LParen '('>
                                words: [
                                  {
                                    (DQ 
                                      (braced_var_sub
                                        token: <VSub_Name BATS_CURRENT_STACK_TRACE>
                                        bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                                      )
                                    )
                                  }
                                ]
                              )
                            }
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (C {(bats_exit_trap)})
          ]
        )
    )
    (command.ShFunction
      name: bats_exit_trap
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(status)})
            (C {(local)} {(skipped)})
            (C {(trap)} {(-)} {(err)} {(ControlFlow_Exit exit)})
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:skipped) op:Equal rhs:{(DQ )})]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-n)} {(DQ ($ VSub_DollarName '$BATS_TEST_SKIPPED'))} 
                          {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:skipped)
                          op: Equal
                          rhs: {(DQ (' # skip'))}
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_LBracket '[')} {(DQ (1))} {(KW_Bang '!') (Lit_Equals '=')} 
                                  {(DQ ($ VSub_DollarName '$BATS_TEST_SKIPPED'))} {(Lit_RBracket ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:skipped)
                                  op: PlusEqual
                                  rhs: {(DQ (' (') ($ VSub_DollarName '$BATS_TEST_SKIPPED') (')'))}
                                )
                              ]
                            )
                          ]
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.AndOr
                          ops: [Op_DPipe]
                          children: [
                            (C {(Lit_LBracket '[')} {(-z)} 
                              {(DQ ($ VSub_DollarName '$BATS_TEST_COMPLETED'))} {(Lit_RBracket ']')}
                            )
                            (C {(Lit_LBracket '[')} {(-z)} 
                              {(DQ ($ VSub_DollarName '$BATS_TEARDOWN_COMPLETED'))} {(Lit_RBracket ']')}
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [
                        {(echo)}
                        {
                          (DQ ('not ok ') ($ VSub_DollarName '$BATS_TEST_NUMBER') (' ') 
                            ($ VSub_DollarName '$BATS_TEST_DESCRIPTION')
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(3)})]
                    )
                    (command.Simple
                      words: [
                        {(bats_print_stack_trace)}
                        {
                          (DQ 
                            (braced_var_sub
                              token: <VSub_Name BATS_ERROR_STACK_TRACE>
                              bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                            )
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(3)})]
                    )
                    (command.Simple
                      words: [
                        {(bats_print_failed_command)}
                        {
                          (DQ 
                            (braced_var_sub
                              token: <VSub_Name BATS_ERROR_STACK_TRACE>
                              bracket_op: 
                                (bracket_op.ArrayIndex
                                  expr: 
                                    (arith_expr.Binary
                                      op_id: Arith_Minus
                                      left: 
                                        (arith_expr.ArithWord
                                          w: 
                                            {
                                              (braced_var_sub
                                                token: <VSub_Name BATS_ERROR_STACK_TRACE>
                                                prefix_op: VSub_Pound
                                                bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                                              )
                                            }
                                        )
                                      right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                                    )
                                )
                            )
                          )
                        }
                        {(DQ ($ VSub_DollarName '$BATS_ERROR_STATUS'))}
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(3)})]
                    )
                    (command.Simple
                      words: [{(sed)} {(-e)} {(DQ ('s/^/# /'))}]
                      redirects: [
                        (redir.Redir
                          op: <Redir_Less '<'>
                          fd: 16777215
                          arg_word: {(DQ ($ VSub_DollarName '$BATS_OUT'))}
                        )
                        (redir.Redir
                          op: <Redir_GreatAnd '>&'>
                          fd: 16777215
                          arg_word: {(3)}
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:status) op:Equal rhs:{(1)})]
                    )
                  ]
                )
              ]
              else_action: [
                (command.Simple
                  words: [
                    {(echo)}
                    {
                      (DQ ('ok ') (${ VSub_Name BATS_TEST_NUMBER) (${ VSub_Name skipped) (' ') 
                        (${ VSub_Name BATS_TEST_DESCRIPTION)
                      )
                    }
                  ]
                  redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(3)})]
                )
                (command.ShAssignment
                  pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:status) op:Equal rhs:{(0)})]
                )
              ]
            )
            (C {(rm)} {(-f)} {(DQ ($ VSub_DollarName '$BATS_OUT'))})
            (command.ControlFlow
              token: <ControlFlow_Exit exit>
              arg_word: {(DQ ($ VSub_DollarName '$status'))}
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_perform_tests
      body: 
        (command.BraceGroup
          children: [
            (C {(echo)} {(DQ (1..) ($ VSub_Pound '$#'))})
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:test_number) op:Equal rhs:{(1)})]
            )
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:status) op:Equal rhs:{(0)})]
            )
            (command.ForEach
              iter_name: test_name
              iter_words: [{(DQ ($ VSub_At '$@'))}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.AndOr
                      ops: [Op_DPipe]
                      children: [
                        (C {(DQ ($ VSub_Number '$0'))} {($ VSub_DollarName '$BATS_EXTENDED_SYNTAX')} 
                          {(DQ ($ VSub_DollarName '$BATS_TEST_FILENAME'))} {(DQ ($ VSub_DollarName '$test_name'))} {(DQ ($ VSub_DollarName '$test_number'))}
                        )
                        (command.ShAssignment
                          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:status) op:Equal rhs:{(1)})]
                        )
                      ]
                    )
                    (C {(let)} {(Lit_VarLike 'test_number+=') (1)})
                  ]
                )
            )
            (command.ControlFlow
              token: <ControlFlow_Exit exit>
              arg_word: {(DQ ($ VSub_DollarName '$status'))}
            )
          ]
        )
    )
    (command.ShFunction
      name: bats_perform_test
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_TEST_NAME)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} 
                          {
                            (DQ 
                              (command_sub
                                left_token: <Left_DollarParen '$('>
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (command.AndOr
                                        ops: [Op_DPipe]
                                        children: [
                                          (C {(type)} {(-t)} {(DQ ($ VSub_DollarName '$BATS_TEST_NAME'))})
                                          (C {(true)})
                                        ]
                                      )
                                    ]
                                  )
                              )
                            )
                          } {(Lit_Equals '=')} {(DQ (function))} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:BATS_TEST_NUMBER)
                          op: Equal
                          rhs: {(DQ ($ VSub_Number '$2'))}
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_LBracket '[')} {(-z)} 
                                  {(DQ ($ VSub_DollarName '$BATS_TEST_NUMBER'))} {(Lit_RBracket ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} {(DQ (1..1))})
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:BATS_TEST_NUMBER)
                                  op: Equal
                                  rhs: {(DQ (1))}
                                )
                              ]
                            )
                          ]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:BATS_TEST_COMPLETED) op:Equal rhs:{(DQ )})]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:BATS_TEARDOWN_COMPLETED)
                          op: Equal
                          rhs: {(DQ )}
                        )
                      ]
                    )
                    (C {(trap)} 
                      {
                        (DQ ('bats_debug_trap ') 
                          (word_part.EscapedLiteral
                            token: <Lit_EscapedChar '\\"'>
                          ) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\$'>) (BASH_SOURCE) 
                          (word_part.EscapedLiteral
                            token: <Lit_EscapedChar '\\"'>
                          )
                        )
                      } {(debug)}
                    )
                    (C {(trap)} {(DQ (bats_error_trap))} {(err)})
                    (C {(trap)} {(DQ (bats_teardown_trap))} {(ControlFlow_Exit exit)})
                    (command.Simple
                      words: [{(DQ ($ VSub_DollarName '$BATS_TEST_NAME'))}]
                      redirects: [
                        (redir.Redir
                          op: <Redir_DGreat '>>'>
                          fd: 16777215
                          arg_word: {(DQ ($ VSub_DollarName '$BATS_OUT'))}
                        )
                        (redir.Redir
                          op: <Redir_GreatAnd '2>&'>
                          fd: 2
                          arg_word: {(1)}
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:BATS_TEST_COMPLETED)
                          op: Equal
                          rhs: {(1)}
                        )
                      ]
                    )
                  ]
                )
              ]
              else_action: [
                (command.Simple
                  words: [
                    {(echo)}
                    {
                      (DQ ('bats: unknown test name ') 
                        (word_part.EscapedLiteral
                          token: <Lit_EscapedChar '\\`'>
                        ) ($ VSub_DollarName '$BATS_TEST_NAME') ("'")
                      )
                    }
                  ]
                  redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                )
                (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
              ]
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {(-z)} {(DQ ($ VSub_DollarName '$TMPDIR'))} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:BATS_TMPDIR) op:Equal rhs:{(DQ (/tmp))})]
            )
          ]
        )
      ]
      else_action: [
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:BATS_TMPDIR)
              op: Equal
              rhs: 
                {
                  (DQ 
                    (braced_var_sub
                      token: <VSub_Name TMPDIR>
                      suffix_op: (suffix_op.Unary op_id:VOp1_Percent arg_word:{(Lit_Slash /)})
                    )
                  )
                }
            )
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BATS_TMPNAME)
          op: Equal
          rhs: {(DQ ($ VSub_DollarName '$BATS_TMPDIR') (/bats.) ($ VSub_Dollar '$$'))}
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BATS_PARENT_TMPNAME)
          op: Equal
          rhs: {(DQ ($ VSub_DollarName '$BATS_TMPDIR') (/bats.) ($ VSub_DollarName '$PPID'))}
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BATS_OUT)
          op: Equal
          rhs: {(DQ (${ VSub_Name BATS_TMPNAME) (.out))}
        )
      ]
    )
    (command.ShFunction
      name: bats_preprocess_source
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BATS_TEST_SOURCE)
                  op: Equal
                  rhs: {(DQ (${ VSub_Name BATS_TMPNAME) (.src))}
                )
              ]
            )
            (command.Pipeline
              children: [
                (command.BraceGroup
                  children: [
                    (command.Sentence
                      child: 
                        (command.Simple
                          words: [{(tr)} {(-d)} {(SQ <'\\r'>)}]
                          redirects: [
                            (redir.Redir
                              op: <Redir_Less '<'>
                              fd: 16777215
                              arg_word: {(DQ ($ VSub_DollarName '$BATS_TEST_FILENAME'))}
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (command.Sentence child:(C {(echo)}) terminator:<Op_Semi ';'>)
                  ]
                )
                (command.Simple
                  words: [{(bats-preprocess)}]
                  redirects: [
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(DQ ($ VSub_DollarName '$BATS_TEST_SOURCE'))}
                    )
                  ]
                )
              ]
              negated: F
            )
            (C {(trap)} {(DQ (bats_cleanup_preprocessed_source))} {(err)} {(ControlFlow_Exit exit)})
            (C {(trap)} {(DQ ('bats_cleanup_preprocessed_source; exit 1'))} {(int)})
          ]
        )
    )
    (command.ShFunction
      name: bats_cleanup_preprocessed_source
      body: 
        (command.BraceGroup
          children: [(C {(rm)} {(-f)} {(DQ ($ VSub_DollarName '$BATS_TEST_SOURCE'))})]
        )
    )
    (command.ShFunction
      name: bats_evaluate_preprocessed_source
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-z)} {(DQ ($ VSub_DollarName '$BATS_TEST_SOURCE'))} 
                          {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:BATS_TEST_SOURCE)
                          op: Equal
                          rhs: {(DQ (${ VSub_Name BATS_PARENT_TMPNAME) (.src))}
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (C {(source)} {(DQ ($ VSub_DollarName '$BATS_TEST_SOURCE'))})
          ]
        )
    )
    (command.Simple
      words: [{(exec)}]
      redirects: [(redir.Redir op:<Redir_LessAnd '3<&'> fd:3 arg_word:{(1)})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {(DQ ($ VSub_Pound '$#'))} {(-eq)} {(0)} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(bats_preprocess_source)})
            (C {(bats_evaluate_preprocessed_source)})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(-n)} {(DQ ($ VSub_DollarName '$BATS_COUNT_ONLY'))} 
                          {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ 
                          (braced_var_sub
                            token: <VSub_Name BATS_TEST_NAMES>
                            prefix_op: VSub_Pound
                            bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                          )
                        )
                      }
                    )
                  ]
                )
              ]
              else_action: [
                (C {(bats_perform_tests)} 
                  {
                    (DQ 
                      (braced_var_sub
                        token: <VSub_Name BATS_TEST_NAMES>
                        bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                      )
                    )
                  }
                )
              ]
            )
          ]
        )
      ]
      else_action: [
        (C {(bats_evaluate_preprocessed_source)})
        (C {(bats_perform_test)} {(DQ ($ VSub_At '$@'))})
      ]
    )
  ]
)