(command.CommandList
  children: [
    (command.ShFunction
      name: test_fns_copies
      body: 
        (BraceGroup
          children: [
            (C {<typeset>} {<Id.Lit_VarLike 'result='> (SQ <bogus>)})
            (C {<_Dbg_copies>} {(SQ <a>)} {<-1>})
            (C {<assertFalse>} {(SQ <'_Dbg_copies "a" -1 should fail'>)} {(DQ ($ Id.VSub_QMark '$?'))})
            (C {<_Dbg_copies>} {(SQ <a>)} {<3>})
            (C {<assertTrue>} {(SQ <'_Dbg_copies "a" 3 should succeed'>)} {(DQ ($ Id.VSub_QMark '$?'))})
            (C {<assertEquals>} {(SQ <aaa>)} {($ Id.VSub_DollarName '$result')})
            (C {<_Dbg_copies>} {(SQ <' ab'>)} {<4>})
            (C {<assertTrue>} {(SQ <'_Dbg_copies " ab" 4 should succeed'>)} {(DQ ($ Id.VSub_QMark '$?'))})
            (C {<assertEquals>} {(SQ <' ab ab ab ab'>)} {(DQ ($ Id.VSub_DollarName '$result'))})
          ]
        )
    )
    (command.ShFunction
      name: test_fns_defined
      body: 
        (BraceGroup
          children: [
            (C {<typeset>} {<Id.Lit_VarLike 'p='> <5>})
            (C {<_Dbg_defined>} {<p>})
            (C {<assertTrue>} {(SQ <'p should be defined'>)} {(DQ ($ Id.VSub_QMark '$?'))})
            (C {<unset>} {<p>})
            (C {<_Dbg_defined>} {<p>})
            (C {<assertFalse>} {(SQ <'p should now not defined'>)} {(DQ ($ Id.VSub_QMark '$?'))})
          ]
        )
    )
    (command.ShFunction
      name: test_fns_esc_dq
      body: 
        (BraceGroup
          children: [
            (command.ShFunction
              name: check_esc_dq
              body: 
                (BraceGroup
                  children: [
                    (C {<local>} {<Id.Lit_VarLike 'orig='> (DQ ($ Id.VSub_Number '$1'))})
                    (C {<local>} 
                      {<Id.Lit_VarLike 'transform='> 
                        (DQ 
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: (C {<_Dbg_esc_dq>} {(DQ ($ Id.VSub_DollarName '$orig'))})
                          )
                        )
                      }
                    )
                    (C {<eval>} {(SQ <'got=$(echo "$1")'>)})
                    (C {<assertEquals>} {(DQ ($ Id.VSub_DollarName '$orig'))} 
                      {(DQ ($ Id.VSub_DollarName '$got'))}
                    )
                  ]
                )
            )
            (C {<check_esc_dq>} {(SQ <'Now is the time'>)})
            (C {<check_esc_dq>} {(SQ <'"Now is the time"'>)})
            (C {<check_esc_dq>} {(SQ <'Make $$'>)})
            (C {<assertEquals>} {(SQ <abc>)} 
              {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<_Dbg_esc_dq>} {<abc>}))}
            )
            (C {<assertEquals>} {(SQ <'\\\\\\"abc\\\\\\"'>)} 
              {
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<_Dbg_esc_dq>} {(SQ <'\\"abc\\"'>)})
                )
              }
            )
            (C {<assertEquals>} {(SQ <'\\\\\\"a\\\\bc\\\\\\"'>)} 
              {
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<_Dbg_esc_dq>} {(SQ <'\\"a\\bc\\"'>)})
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_fns_is_function
      body: 
        (BraceGroup
          children: [
            (C {<_Dbg_is_function>})
            (C {<assertFalse>} {(SQ <'No function given; is_function should report false'>)} 
              {($ Id.VSub_QMark '$?')}
            )
            (C {<unset>} {<-f>} {<function_test>})
            (C {<_Dbg_is_function>} {<function_test>})
            (C {<assertFalse>} {(SQ <'function_test should not be defined'>)} 
              {(DQ ($ Id.VSub_QMark '$?'))}
            )
            (C {<typeset>} {<-i>} {<Id.Lit_VarLike 'function_test='> <1>})
            (C {<_Dbg_is_function>} {<function_test>})
            (C {<assertFalse>} {(SQ <'test_function should still not be defined'>)} 
              {(DQ ($ Id.VSub_QMark '$?'))}
            )
            (command.ShFunction
              name: function_test
              body: 
                (BraceGroup
                  children: [
                    (command.Sentence
                      child: (C {<Id.Lit_Colon ':'>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
            )
            (C {<_Dbg_is_function>} {<function_test>})
            (C {<assertTrue>} {(SQ <'test_function should now be defined'>)} 
              {(DQ ($ Id.VSub_QMark '$?'))}
            )
            (command.ShFunction
              name: another_function_test
              body: 
                (BraceGroup
                  children: [
                    (command.Sentence
                      child: (C {<Id.Lit_Colon ':'>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
            )
            (C {<_Dbg_is_function>} {<another_function_test>} {(DQ ($ Id.VSub_QMark '$?'))})
            (command.ShFunction
              name: _function_test
              body: 
                (BraceGroup
                  children: [
                    (command.Sentence
                      child: (C {<Id.Lit_Colon ':'>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
            )
            (C {<_Dbg_is_function>} {<_function_test>})
            (C {<assertFalse>} 
              {(SQ <'fn _function_test is system fn; is_function should report false'>)} {($ Id.VSub_QMark '$?')}
            )
            (C {<_Dbg_is_function>} {<_function_test>} {<1>})
            (C {<assertTrue>} 
              {(SQ <'fn _function_test is system fn which we want; should report true'>)} {($ Id.VSub_QMark '$?')}
            )
          ]
        )
    )
    (command.ShFunction
      name: test_fns_traced
      body: 
        (BraceGroup
          children: [
            (C {<set>} {<Id.Lit_Other '+'> <x>})
            (C {<_Dbg_is_traced>})
            (C {<assertFalse>} {(SQ <'is_traced should be false'>)} {(DQ ($ Id.VSub_QMark '$?'))})
            (BraceGroup
              children: [
                (C {<set>} {<-x>})
                (C {<_Dbg_is_traced>})
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:rc)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_QMark '$?')}
                      spids: [504]
                    )
                  ]
                )
                (C {<set>} {<Id.Lit_Other '+'> <x>})
              ]
              redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})]
            )
            (C {<assertTrue>} {(SQ <'is_traced should be true'>)} {(DQ ($ Id.VSub_DollarName '$rc'))})
          ]
        )
    )
    (command.ShFunction
      name: test_fns_onoff
      body: 
        (BraceGroup
          children: [
            (C {<assertEquals>} {(SQ <on.>)} 
              {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<_Dbg_onoff>} {<1>}))}
            )
            (C {<assertEquals>} {(SQ <off.>)} 
              {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<_Dbg_onoff>} {<0>}))}
            )
          ]
        )
    )
    (command.ShFunction
      name: test_fns_parse_linespec
      body: 
        (BraceGroup
          children: [
            (C {<typeset>} 
              {<Id.Lit_VarLike '_seteglob='> 
                (SQ <'local __eopt=-u ; shopt -q extglob && __eopt=-s ; shopt -s extglob'>)
              }
            )
            (C {<shopt>} {<-s>} {<extdebug>})
            (C {<typeset>} {<Id.Lit_VarLike 'int_pat='> (DQ <'[0-9]*([0-9])'>)})
            (C {<typeset>} {<-i>} {<Id.Lit_VarLike '_Dbg_set_debug='> <1>})
            (command.ShFunction
              name: foo
              body: 
                (BraceGroup
                  children: [
                    (command.Sentence
                      child: (C {<echo>} {(SQ <'foo here'>)})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
            )
            (C {<typeset>} {<-a>} 
              {<Id.Lit_VarLike 'words='> 
                (sh_array_literal
                  left: <Id.Op_LParen _>
                  words: [
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_parse_linespec>} {(SQ <'foo:4'>)})
                      )
                    }
                  ]
                )
              }
            )
            (C {<assertEquals>} {(SQ <a>)} {(SQ <4>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>})
                )
              }
            )
            (C {<assertEquals>} {(SQ <b>)} {(SQ <0>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 1>})
                )
              }
            )
            (C {<typeset>} {<-a>} 
              {<Id.Lit_VarLike 'words='> 
                (sh_array_literal
                  left: <Id.Op_LParen _>
                  words: [
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_parse_linespec>} {(SQ <test_fns_defined>)})
                      )
                    }
                  ]
                )
              }
            )
            (C {<assertEquals>} {(SQ <c>)} {(SQ <23>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>})
                )
              }
            )
            (C {<assertEquals>} {(SQ <d>)} {(SQ <1>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 1>})
                )
              }
            )
            (C {<typeset>} {<-a>} 
              {<Id.Lit_VarLike 'words='> 
                (sh_array_literal
                  left: <Id.Op_LParen _>
                  words: [
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_parse_linespec>} {(SQ <_Dbg_parse_linespec>)})
                      )
                    }
                  ]
                )
              }
            )
            (C {<assertEquals>} {(SQ <e>)} {(SQ <3>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  prefix_op: (Id.VSub_Pound)
                  bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                )
              }
            )
            (C {<typeset>} {<Id.Lit_VarLike '_Dbg_set_debug='> <0>})
            (C {<typeset>} {<-a>} 
              {<Id.Lit_VarLike 'words='> 
                (sh_array_literal
                  left: <Id.Op_LParen _>
                  words: [
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_parse_linespec>} {(SQ <_Dbg_parse_linespec>)})
                      )
                    }
                  ]
                )
              }
            )
            (C {<assertEquals>} {(SQ <e>)} {(SQ <0>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  prefix_op: (Id.VSub_Pound)
                  bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                )
              }
            )
            (C {<unset>} {<foo>})
            (C {<typeset>} {<-a>} 
              {<Id.Lit_VarLike 'words='> 
                (sh_array_literal
                  left: <Id.Op_LParen _>
                  words: [
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_parse_linespec>} {(SQ <foo>)})
                      )
                    }
                  ]
                )
              }
            )
            (C {<assertEquals>} {(SQ <f>)} {(SQ <0>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  prefix_op: (Id.VSub_Pound)
                  bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_set_debugger_internal
      body: 
        (BraceGroup
          children: [
            (C {<typeset>} {<Id.Lit_VarLike '_Dbg_space_IFS='> (SQ <' '>)})
            (C {<_Dbg_set_debugger_internal>})
            (C {<assertEquals>} {(DQ ($ Id.VSub_DollarName '$_Dbg_space_IFS'))} 
              {(DQ ($ Id.VSub_DollarName '$IFS'))}
            )
            (C {<assertEquals>} 
              {(SQ <'+ dbg (${BASH_SOURCE}:${LINENO}[$BASH_SUBSHELL]): ${FUNCNAME[0]}\\n'>)} {(DQ ($ Id.VSub_DollarName '$PS4'))}
            )
          ]
        )
    )
    (command.ShFunction
      name: test_fns_set_q
      body: 
        (BraceGroup
          children: [
            (C {<_Dbg_set_dol_q>} {<1>})
            (C {<assertFalse>} {(SQ <'$? should have been set to 1==false'>)} {($ Id.VSub_QMark '$?')})
            (C {<_Dbg_set_dol_q>} {<0>})
            (C {<assertTrue>} {(SQ <'$? should have been set to 0==true'>)} {($ Id.VSub_QMark '$?')})
            (C {<local>} {<Id.Lit_VarLike '_Ddg_debugged_exit_code='> <0>})
            (C {<_Dbg_set_dol_q>})
            (C {<assertTrue>} {(SQ <'$? should be set true via _Dbg_debugged_exit_code'>)} 
              {($ Id.VSub_QMark '$?')}
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:_Ddg_debugged_exit_code)
                  op: assign_op.Equal
                  rhs: {<1>}
                  spids: [971]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_fns_split
      body: 
        (BraceGroup
          children: [
            (C {<typeset>} {<-a>} {<words>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:words)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (sh_array_literal
                        left: <Id.Op_LParen _>
                        words: [
                          {
                            (command_sub
                              left_token: <Id.Left_DollarParen '$('>
                              child: (C {<_Dbg_split>} {(SQ <':'>)} {(SQ <'foo:bar'>)})
                            )
                          }
                        ]
                      )
                    }
                  spids: [999]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <foo>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>})
                )
              }
            )
            (C {<assertEquals>} {(SQ <bar>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 1>})
                )
              }
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:words)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (sh_array_literal
                        left: <Id.Op_LParen _>
                        words: [
                          {
                            (command_sub
                              left_token: <Id.Left_DollarParen '$('>
                              child: (C {<_Dbg_split>} {(SQ <':'>)} {(SQ <foo>)})
                            )
                          }
                        ]
                      )
                    }
                  spids: [1043]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <foo>)} 
              {
                (braced_var_sub
                  token: <Id.VSub_Name words>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>})
                )
              }
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:abs_top_srcdir)
          op: assign_op.Equal
          rhs: {<'/src/external-vcs/sourceforge/bashdb'>}
          spids: [1075]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:abs_top_srcdir)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: <Id.VSub_Name abs_top_srcdir>
                suffix_op: (suffix_op.Unary tok:<Id.VOp1_DPercent '%%'> arg_word:{<Id.Lit_Slash '/'>})
              ) <'/'>
            }
          spids: [1081]
        )
      ]
    )
    (C {<.>} {(${ Id.VSub_Name abs_top_srcdir) <'test/unit/helper.sh'>})
    (C {<.>} {(${ Id.VSub_Name abs_top_srcdir) <'init/pre.sh'>})
    (C {<.>} {(${ Id.VSub_Name abs_top_srcdir) <'lib/fns.sh'>})
    (C {<.>} {(${ Id.VSub_Name abs_top_srcdir) <'lib/journal.sh'>})
    (C {<.>} {(${ Id.VSub_Name abs_top_srcdir) <'lib/save-restore.sh'>})
    (C {<.>} {(${ Id.VSub_Name abs_top_srcdir) <'lib/validate.sh'>})
    (C {<set>} {<-->})
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (command.DBracket
          expr: 
            (bool_expr.Binary
              op_id: Id.BoolBinary_GlobDEqual
              left: {($ Id.VSub_Number '$0')}
              right: {(${ Id.VSub_Name BASH_SOURCE)}
            )
        )
        (C {<.>} {(${ Id.VSub_Name shunit_file)})
      ]
    )
  ]
)