(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:DIR)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [
                          (C {(cd)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [
                                        (C {(dirname)} 
                                          {
                                            (DQ 
                                              (BracedVarSub
                                                token: <VSub_Name BASH_SOURCE>
                                                bracket_op: 
                                                  (ArrayIndex
                                                    expr: (ArithWord w:{(Lit_Digits 0)})
                                                  )
                                                spids: [64 69]
                                              )
                                            )
                                          }
                                        )
                                      ]
                                    )
                                  left_token: <Left_CommandSub "$(">
                                  spids: [60 71]
                                )
                              )
                            }
                          )
                          (C {(pwd)})
                        ]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [56 77]
              )
            }
          spids: [55]
        )
      ]
      spids: [55]
    )
    (AndOr
      children: [
        (C {(source)} {(${ VSub_Name DIR) (/unittest.bash)})
        (BraceGroup
          children: [
            (Sentence
              child: 
                (SimpleCommand
                  words: [{(echo)} {(DQ ("Could not source unittest.sh"))}]
                  redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[96])]
                )
              terminator: <Op_Semi ";">
            )
            (Sentence child:(C {(exit)} {(1)}) terminator:<Op_Semi ";">)
          ]
          spids: [88]
        )
      ]
      op_id: Op_DPipe
    )
    (FuncDef
      name: set_up
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:tmp_TEST_TMPDIR)
                  op: Equal
                  rhs: {($ VSub_Name "$TEST_TMPDIR")}
                  spids: [117]
                )
              ]
              spids: [117]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:TEST_TMPDIR)
                  op: Equal
                  rhs: {($ VSub_Name "$TEST_TMPDIR") (/) ($ VSub_Name "$TEST_name")}
                  spids: [121]
                )
              ]
              spids: [121]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name "$TEST_TMPDIR")})
          ]
          spids: [114]
        )
      spids: [108 113]
    )
    (FuncDef
      name: tear_down
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:TEST_TMPDIR)
                  op: Equal
                  rhs: {($ VSub_Name "$tmp_TEST_TMPDIR")}
                  spids: [145]
                )
              ]
              spids: [145]
            )
          ]
          spids: [142]
        )
      spids: [136 141]
    )
    (FuncDef
      name: test_1
      body: (BraceGroup children:[(C {(echo)} {(DQ ("Everything is okay in test_1"))})] spids:[157])
      spids: [151 156]
    )
    (FuncDef
      name: test_2
      body: (BraceGroup children:[(C {(echo)} {(DQ ("Everything is okay in test_2"))})] spids:[175])
      spids: [169 174]
    )
    (FuncDef
      name: test_timestamp
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:ts)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(timestamp)})])
                        left_token: <Left_CommandSub "$(">
                        spids: [199 201]
                      )
                    }
                  spids: [198]
                )
              ]
              spids: [196]
            )
            (AndOr
              children: [
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_EqualTilde
                      left: {($ VSub_Name "$ts")}
                      right: 
                        {(Lit_Other "^") (Lit_Other "[") (0-9) (Lit_Other "]") (Lit_LBrace "{") (13) 
                          (Lit_RBrace "}") (Lit_Other "$")
                        }
                    )
                )
                (C {(fail)} {(DQ ("timestamp wan't valid: ") ($ VSub_Name "$ts"))})
              ]
              op_id: Op_DPipe
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:time_diff)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(get_run_time)} {(100000)} {(223456)})]
                          )
                        left_token: <Left_CommandSub "$(">
                        spids: [235 241]
                      )
                    }
                  spids: [234]
                )
              ]
              spids: [232]
            )
            (C {(assert_equals)} {($ VSub_Name "$time_diff")} {(123.456)})
          ]
          spids: [193]
        )
      spids: [187 192]
    )
    (FuncDef
      name: test_failure_message
      body: 
        (BraceGroup
          children: [
            (C {(cd)} {($ VSub_Name "$TEST_TMPDIR")})
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(thing.sh)} spids:[269])
                (HereDoc
                  op_id: Redir_DLess
                  fd: -1
                  body: 
                    {
                      (DQ ("#!/bin/bash\n") ("XML_OUTPUT_FILE=") (${ VSub_Name TEST_TMPDIR) 
                        ("/dummy.xml\n") ("source ") (${ VSub_Name DIR) ("/unittest.bash\n") ("\n") ("function test_thing() {\n") ("  fail ") 
                        (Right_DoubleQuote "\"") ("I'm a failure") (Right_DoubleQuote "\"") ("\n") ("}\n") ("\n") ("run_suite ") (Right_DoubleQuote "\"") 
                        ("thing tests") (Right_DoubleQuote "\"") ("\n")
                      )
                    }
                  do_expansion: True
                  here_end: EOF
                  was_filled: True
                  spids: [273]
                )
              ]
            )
            (C {(chmod)} {(Lit_Other "+") (x)} {(thing.sh)})
            (Sentence child:(C {(./thing.sh)}) terminator:<Op_Amp "&">)
            (AndOr
              children: [
                (SimpleCommand
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [313]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("thing.sh should fail"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_not_log)} {(DQ ("__fail: No such file or directory"))})
            (C {(assert_contains)} {(DQ ("I'm a failure."))} {(${ VSub_Name TEST_TMPDIR) (/dummy.xml)})
          ]
          spids: [259]
        )
      spids: [253 258]
    )
    (FuncDef
      name: test_no_failure_message
      body: 
        (BraceGroup
          children: [
            (C {(cd)} {($ VSub_Name "$TEST_TMPDIR")})
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(thing.sh)} spids:[363])
                (HereDoc
                  op_id: Redir_DLess
                  fd: -1
                  body: 
                    {
                      (DQ ("#!/bin/bash\n") ("XML_OUTPUT_FILE=") (${ VSub_Name TEST_TMPDIR) 
                        ("/dummy.xml\n") ("source ") (${ VSub_Name DIR) ("/unittest.bash\n") ("\n") ("function test_thing() {\n") 
                        ("  TEST_passed=blorp\n") ("}\n") ("\n") ("run_suite ") (Right_DoubleQuote "\"") ("thing tests") (Right_DoubleQuote "\"") ("\n")
                      )
                    }
                  do_expansion: True
                  here_end: EOF
                  was_filled: True
                  spids: [367]
                )
              ]
            )
            (C {(chmod)} {(Lit_Other "+") (x)} {(thing.sh)})
            (Sentence child:(C {(./thing.sh)}) terminator:<Op_Amp "&">)
            (AndOr
              children: [
                (SimpleCommand
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [403]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("thing.sh should fail"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_not_log)} {(DQ ("__fail: No such file or directory"))})
            (C {(assert_contains)} {(DQ ("No failure message"))} 
              {(${ VSub_Name TEST_TMPDIR) (/dummy.xml)}
            )
          ]
          spids: [353]
        )
      spids: [347 352]
    )
    (FuncDef
      name: test_errexit_prints_stack_trace
      body: 
        (BraceGroup
          children: [
            (C {(cd)} {($ VSub_Name "$TEST_TMPDIR")})
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(thing.sh)} spids:[453])
                (HereDoc
                  op_id: Redir_DLess
                  fd: -1
                  body: 
                    {
                      (DQ ("#!/bin/bash\n") ("XML_OUTPUT_FILE=") (${ VSub_Name TEST_TMPDIR) 
                        ("/dummy.xml\n") ("source ") (${ VSub_Name DIR) ("/unittest.bash\n") ("\n") ("enable_errexit\n") ("\n") 
                        ("function helper() {\n") ("  echo before\n") ("  false\n") ("  echo after\n") ("}\n") ("\n") ("function test_thing() {\n") 
                        ("  helper\n") ("}\n") ("\n") ("run_suite ") (Right_DoubleQuote "\"") ("thing tests") (Right_DoubleQuote "\"") ("\n")
                      )
                    }
                  do_expansion: True
                  here_end: EOF
                  was_filled: True
                  spids: [457]
                )
              ]
            )
            (C {(chmod)} {(Lit_Other "+") (x)} {(thing.sh)})
            (Sentence child:(C {(./thing.sh)}) terminator:<Op_Amp "&">)
            (AndOr
              children: [
                (SimpleCommand
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [501]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("thing.sh should fail"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_log)} 
              {
                (DQ 
                  (
"test_thing FAILED: terminated because this command returned a non-zero status:"
                  )
                )
              }
            )
            (C {(expect_log)} {(DQ ("./thing.sh:[0-9]*: in call to helper"))})
            (C {(expect_log)} {(DQ ("./thing.sh:[0-9]*: in call to test_thing"))})
          ]
          spids: [443]
        )
      spids: [437 442]
    )
    (C {(run_suite)} {(DQ ("unittests Tests"))})
  ]
)