(command.CommandList
  children: [
    (command.Sentence child:(C {(set)} {(-u)}) terminator:<Op_Semi ';'>)
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (C {(Lit_Other '[')} 
          {
            (word_part.BracedVarSub
              token: <VSub_Name COMMON_SH>
              suffix_op: (suffix_op.StringUnary op_id:VTest_Plus arg_word:{(true)})
            )
          } {(Lit_Other ']')}
        )
        (command.ControlFlow token:<ControlFlow_Return return>)
      ]
    )
    (command.Assignment
      keyword: Assign_Declare
      flags: [-g]
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:COMMON_SH) op:Equal rhs:{(true)})]
    )
    (command.FuncDef
      name: stderr
      body: 
        (command.BraceGroup
          children: [
            (command.SimpleCommand
              words: [{(echo)} {(DQ (${ VSub_At '@'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})]
            )
          ]
        )
    )
    (command.FuncDef
      name: functionExists
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Declare
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:functionName)
                  op: Equal
                  rhs: {(DQ (${ VSub_Number 1))}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Declare
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:type)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(type)} {(-t)} {(DQ (${ VSub_Name functionName))})]
                          )
                        left_token: <Left_DollarParen '$('>
                      )
                    }
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.BoolBinary
                              op_id: BoolBinary_GlobNEqual
                              left: {($ VSub_QMark '$?')}
                              right: {(0)}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(command.ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})]
                )
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {($ VSub_DollarName '$type')}
                              right: {(DQ (function))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(command.ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})]
                )
              ]
              else_action: [(command.ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})]
            )
          ]
        )
    )
    (command.Assignment
      keyword: Assign_Declare
      flags: [-g -A]
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:ASSERT_RESULTS)
          op: Equal
          rhs: 
            {
              (word_part.ArrayLiteralPart
                words: [
                  {(Lit_Other '[') (total) (Lit_ArrayLhsClose ']=') (0)}
                  {(Lit_Other '[') (passed) (Lit_ArrayLhsClose ']=') (0)}
                  {(Lit_Other '[') (failed) (Lit_ArrayLhsClose ']=') (0)}
                ]
              )
            }
        )
      ]
    )
    (command.FuncDef
      name: 'assert::equals'
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Declare
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:expect)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Declare
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:actual)
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Declare
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:message)
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_At '@'>
                        suffix_op: (suffix_op.Slice begin:(arith_expr.ArithWord w:{(Lit_Digits 3)}))
                      )
                    }
                )
              ]
            )
            (command.DParen
              child: 
                (arith_expr.BinaryAssign
                  op_id: Arith_PlusEqual
                  left: 
                    (lhs_expr.LhsIndexedName
                      name: ASSERT_RESULTS
                      index: (arith_expr.ArithVarRef token:<Lit_ArithVarLike total>)
                    )
                  right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                )
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_Other '[')} {(DQ ($ VSub_DollarName '$expect'))} 
                          {(KW_Bang '!') (Lit_Other '=')} {(DQ ($ VSub_DollarName '$actual'))} {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ("FAILED ('") ($ VSub_DollarName '$expect') ("' != '") 
                          ($ VSub_DollarName '$actual') ("') ") ($ VSub_DollarName '$message')
                        )
                      }
                    )
                    (C {(log)} 
                      {
                        (DQ ("FAILED ('") ($ VSub_DollarName '$expect') ("' != '") 
                          ($ VSub_DollarName '$actual') ("') ") ($ VSub_DollarName '$message')
                        )
                      }
                    )
                    (command.DParen
                      child: 
                        (arith_expr.BinaryAssign
                          op_id: Arith_PlusEqual
                          left: 
                            (lhs_expr.LhsIndexedName
                              name: ASSERT_RESULTS
                              index: (arith_expr.ArithVarRef token:<Lit_ArithVarLike failed>)
                            )
                          right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                        )
                    )
                    (command.ControlFlow
                      token: <ControlFlow_Return return>
                      arg_word: {(1)}
                    )
                  ]
                )
              ]
            )
            (C {(echo)} {(DQ ('PASSED ') ($ VSub_DollarName '$message'))})
            (command.DParen
              child: 
                (arith_expr.BinaryAssign
                  op_id: Arith_PlusEqual
                  left: 
                    (lhs_expr.LhsIndexedName
                      name: ASSERT_RESULTS
                      index: (arith_expr.ArithVarRef token:<Lit_ArithVarLike passed>)
                    )
                  right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                )
            )
            (command.ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})
          ]
        )
    )
    (command.FuncDef
      name: 'assert::report'
      body: 
        (command.BraceGroup
          children: [
            (C {(echo)} 
              {
                (DQ ('TESTS [total=') 
                  (word_part.BracedVarSub
                    token: <VSub_Name ASSERT_RESULTS>
                    bracket_op: 
                      (bracket_op.ArrayIndex
                        expr: (arith_expr.ArithVarRef token:<Lit_ArithVarLike total>)
                      )
                  ) ('] [passed=') 
                  (word_part.BracedVarSub
                    token: <VSub_Name ASSERT_RESULTS>
                    bracket_op: 
                      (bracket_op.ArrayIndex
                        expr: (arith_expr.ArithVarRef token:<Lit_ArithVarLike passed>)
                      )
                  ) ('] [failed=') 
                  (word_part.BracedVarSub
                    token: <VSub_Name ASSERT_RESULTS>
                    bracket_op: 
                      (bracket_op.ArrayIndex
                        expr: (arith_expr.ArithVarRef token:<Lit_ArithVarLike failed>)
                      )
                  ) (']')
                )
              }
            )
          ]
        )
    )
  ]
)