(command.CommandList
  children: [
    (command.Sentence child:(C {<set>} {<-u>}) terminator:<Id.Op_Semi _>)
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (C {<Id.Lit_LBracket '['>} 
          {
            (braced_var_sub
              token: <Id.VSub_Name COMMON_SH>
              suffix_op: (suffix_op.Unary tok:<Id.VTest_Plus '+'> arg_word:{<true>})
            )
          } {<Id.Lit_RBracket ']'>}
        )
        (command.ControlFlow token:<Id.ControlFlow_Return return>)
      ]
    )
    (C {<declare>} {<-g>} {<Id.Lit_VarLike 'COMMON_SH='> <true>})
    (command.ShFunction
      name: stderr
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<echo>} {(DQ (${ Id.VSub_At '@'))}]
              redirects: [(redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})]
              do_fork: T
            )
          ]
        )
    )
    (command.ShFunction
      name: functionExists
      body: 
        (BraceGroup
          children: [
            (C {<declare>} {<Id.Lit_VarLike 'functionName='> (DQ (${ Id.VSub_Number 1))})
            (C {<declare>} 
              {<Id.Lit_VarLike 'type='> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<type>} {<-t>} {(DQ (${ Id.VSub_Name functionName))})
                )
              }
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Binary
                                  op_id: Id.BoolBinary_GlobNEqual
                                  left: {($ Id.VSub_QMark '$?')}
                                  right: {<0>}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [(command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>})]
                  spids: [110 123]
                )
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Binary
                                  op_id: Id.BoolBinary_GlobDEqual
                                  left: {($ Id.VSub_DollarName '$type')}
                                  right: {(DQ <function>)}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [(command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>})]
                  spids: [135 150]
                )
              ]
              else_action: [(command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>})]
            )
          ]
        )
    )
    (C {<declare>} {<-g>} {<-A>} 
      {<Id.Lit_VarLike 'ASSERT_RESULTS='> 
        (word_part.AssocArrayLiteral
          left: <Id.Op_LParen _>
          pairs: [{<total>} {<0>} {<passed>} {<0>} {<failed>} {<0>}]
        )
      }
    )
    (command.ShFunction
      name: 'assert::equals'
      body: 
        (BraceGroup
          children: [
            (C {<declare>} {<Id.Lit_VarLike 'expect='> ($ Id.VSub_Number '$1')})
            (C {<declare>} {<Id.Lit_VarLike 'actual='> ($ Id.VSub_Number '$2')})
            (C {<declare>} 
              {<Id.Lit_VarLike 'message='> 
                (braced_var_sub
                  token: <Id.VSub_At '@'>
                  suffix_op: (suffix_op.Slice begin:{<Id.Lit_Digits 3>})
                )
              }
            )
            (command.DParen
              child: 
                (arith_expr.BinaryAssign
                  op_id: Id.Arith_PlusEqual
                  left: 
                    (arith_expr.Binary
                      op_id: Id.Arith_LBracket
                      left: <Id.Lit_ArithVarLike ASSERT_RESULTS>
                      right: <Id.Lit_ArithVarLike total>
                    )
                  right: {<Id.Lit_Digits 1>}
                )
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$expect'))} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ ($ Id.VSub_DollarName '$actual'))} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'FAILED (\''> ($ Id.VSub_DollarName '$expect') <'\' != \''> 
                          ($ Id.VSub_DollarName '$actual') <'\') '> ($ Id.VSub_DollarName '$message')
                        )
                      }
                    )
                    (C {<log>} 
                      {
                        (DQ <'FAILED (\''> ($ Id.VSub_DollarName '$expect') <'\' != \''> 
                          ($ Id.VSub_DollarName '$actual') <'\') '> ($ Id.VSub_DollarName '$message')
                        )
                      }
                    )
                    (command.DParen
                      child: 
                        (arith_expr.BinaryAssign
                          op_id: Id.Arith_PlusEqual
                          left: 
                            (arith_expr.Binary
                              op_id: Id.Arith_LBracket
                              left: <Id.Lit_ArithVarLike ASSERT_RESULTS>
                              right: <Id.Lit_ArithVarLike failed>
                            )
                          right: {<Id.Lit_Digits 1>}
                        )
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Return return>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [243 261]
                )
              ]
            )
            (C {<echo>} {(DQ <'PASSED '> ($ Id.VSub_DollarName '$message'))})
            (command.DParen
              child: 
                (arith_expr.BinaryAssign
                  op_id: Id.Arith_PlusEqual
                  left: 
                    (arith_expr.Binary
                      op_id: Id.Arith_LBracket
                      left: <Id.Lit_ArithVarLike ASSERT_RESULTS>
                      right: <Id.Lit_ArithVarLike passed>
                    )
                  right: {<Id.Lit_Digits 1>}
                )
            )
            (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>})
          ]
        )
    )
    (command.ShFunction
      name: 'assert::report'
      body: 
        (BraceGroup
          children: [
            (C {<echo>} 
              {
                (DQ <'TESTS [total='> 
                  (braced_var_sub
                    token: <Id.VSub_Name ASSERT_RESULTS>
                    bracket_op: (bracket_op.ArrayIndex expr:<Id.Lit_ArithVarLike total>)
                  ) <'] [passed='> 
                  (braced_var_sub
                    token: <Id.VSub_Name ASSERT_RESULTS>
                    bracket_op: (bracket_op.ArrayIndex expr:<Id.Lit_ArithVarLike passed>)
                  ) <'] [failed='> 
                  (braced_var_sub
                    token: <Id.VSub_Name ASSERT_RESULTS>
                    bracket_op: (bracket_op.ArrayIndex expr:<Id.Lit_ArithVarLike failed>)
                  ) <']'>
                )
              }
            )
          ]
        )
    )
  ]
)