(command.CommandList
  children: [
    (command.ShFunction
      name: test_file_file_canonic
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:_Dbg_set_basename)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [17]
                )
              ]
            )
            (command.ForEach
              iter_name: file
              iter_words: [{<'/tmp/foo.bar'>} {<'/a/b/foo.bar'>} {<foo.bar>}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (C {<typeset>} {<canonic_file>})
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:canonic_file)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: <Id.Left_DollarParen '$('>
                                child: (C {<_Dbg_file_canonic>} {(DQ ($ Id.VSub_DollarName '$file'))})
                              )
                            }
                          spids: [43]
                        )
                      ]
                    )
                    (C {<assertEquals>} {(SQ <'canonic_file should return 0'>)} {(SQ <0>)} 
                      {($ Id.VSub_QMark '$?')}
                    )
                    (C {<assertEquals>} {(SQ <'canonic_file should do nothing'>)} 
                      {(DQ ($ Id.VSub_DollarName '$file'))} {(DQ ($ Id.VSub_DollarName '$canonic_file'))}
                    )
                  ]
                )
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:_Dbg_set_basename)
                  op: assign_op.Equal
                  rhs: {<1>}
                  spids: [85]
                )
              ]
            )
            (C {<typeset>} {<canonic_file>})
            (command.ForEach
              iter_name: file
              iter_words: [{<'/tmp/foo.bar'>} {<'/a/b/foo.bar'>} {<foo.bar>}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:canonic_file)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: <Id.Left_DollarParen '$('>
                                child: (C {<_Dbg_file_canonic>} {(DQ ($ Id.VSub_DollarName '$file'))})
                              )
                            }
                          spids: [111]
                        )
                      ]
                    )
                    (C {<assertEquals>} {(SQ <'canonic_file should return 0'>)} {(SQ <0>)} 
                      {($ Id.VSub_QMark '$?')}
                    )
                    (C {<assertEquals>} {(SQ <'canonic_file should shorten file'>)} {(SQ <foo.bar>)} 
                      {(DQ ($ Id.VSub_DollarName '$canonic_file'))}
                    )
                  ]
                )
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:canonic_file)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_file_canonic>})
                      )
                    }
                  spids: [152]
                )
              ]
            )
            (C {<assertNotEquals>} {(SQ <'canonic_file not should return 0'>)} {(SQ <0>)} 
              {($ Id.VSub_QMark '$?')}
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:_Dbg_set_basename)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [175]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_file_glob_filename
      body: 
        (BraceGroup
          children: [
            (C {<typeset>} {<filename>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: {(SQ )}
                  spids: [197]
                )
              ]
            )
            (C {<_Dbg_tilde_expand_filename>} {($ Id.VSub_DollarName '$shunit_file')})
            (C {<assertEquals>} {(SQ <0>)} {($ Id.VSub_QMark '$?')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name filename>
                        suffix_op: 
                          (suffix_op.Unary
                            tok: <Id.VOp1_DPound '##'>
                            arg_word: {<Id.Lit_Other '*'> <Id.Lit_Slash '/'>}
                          )
                      )
                    }
                  spids: [216]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <shunit2>)} {($ Id.VSub_DollarName '$filename')})
            (C {<_Dbg_tilde_expand_filename>} 
              {<'./'> (${ Id.VSub_Name srcdir) <shunit> <Id.Lit_QMark '?'>}
            )
            (C {<assertEquals>} {(SQ <0>)} {($ Id.VSub_QMark '$?')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name filename>
                        suffix_op: 
                          (suffix_op.Unary
                            tok: <Id.VOp1_DPound '##'>
                            arg_word: {<Id.Lit_Other '*'> <Id.Lit_Slash '/'>}
                          )
                      )
                    }
                  spids: [254]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <shunit2>)} {($ Id.VSub_DollarName '$filename')})
            (C {<_Dbg_tilde_expand_filename>} 
              {<'./'> (${ Id.VSub_Name srcdir) <Id.Lit_LBracket '['> <a-s> <Id.Lit_RBracket ']'> <h> 
                <Id.Lit_Star '*'> <nit> <Id.Lit_QMark '?'>
              }
            )
            (C {<assertEquals>} {(SQ <0>)} {($ Id.VSub_QMark '$?')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name filename>
                        suffix_op: 
                          (suffix_op.Unary
                            tok: <Id.VOp1_DPound '##'>
                            arg_word: {<Id.Lit_Other '*'> <Id.Lit_Slash '/'>}
                          )
                      )
                    }
                  spids: [297]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <shunit2>)} {($ Id.VSub_DollarName '$filename')})
            (C {<_Dbg_tilde_expand_filename>} {(${ Id.VSub_Name srcdir) <abcdefg>})
            (C {<assertEquals>} {(SQ <1>)} {($ Id.VSub_QMark '$?')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name filename>
                        suffix_op: 
                          (suffix_op.Unary
                            tok: <Id.VOp1_DPound '##'>
                            arg_word: {<Id.Lit_Other '*'> <Id.Lit_Slash '/'>}
                          )
                      )
                    }
                  spids: [333]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <abcdefg>)} {(DQ ($ Id.VSub_DollarName '$filename'))})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Unary
                                  op_id: Id.BoolUnary_r
                                  child: {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>)}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<_Dbg_tilde_expand_filename>} {(SQ <'~'>)})
                    (C {<assertEquals>} {(SQ <0>)} {($ Id.VSub_QMark '$?')})
                    (C {<assertEquals>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>)} 
                      {(DQ ($ Id.VSub_DollarName '$filename'))}
                    )
                  ]
                  spids: [354 366]
                )
              ]
            )
            (C {<_Dbg_tilde_expand_filename>} {(${ Id.VSub_Name srcdir) (SQ <'some embedded spaces'>)})
            (C {<assertEquals>} {(SQ <1>)} {($ Id.VSub_QMark '$?')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name filename>
                        suffix_op: 
                          (suffix_op.Unary
                            tok: <Id.VOp1_DPound '##'>
                            arg_word: {<Id.Lit_Other '*'> <Id.Lit_Slash '/'>}
                          )
                      )
                    }
                  spids: [417]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <'some embedded spaces'>)} {(DQ ($ Id.VSub_DollarName '$filename'))})
          ]
        )
    )
    (command.ShFunction
      name: test_file_adjust_filename
      body: 
        (BraceGroup
          children: [
            (C {<typeset>} {<filename>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:_Dbg_set_annotate)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [455]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:_Dbg_set_basename)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [459]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_adjust_filename>} {<abc>})
                      )
                    }
                  spids: [463]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <abc>)} {($ Id.VSub_DollarName '$filename')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_adjust_filename>} {<'/abc'>})
                      )
                    }
                  spids: [480]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <'/abc'>)} {($ Id.VSub_DollarName '$filename')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:_Dbg_set_basename)
                  op: assign_op.Equal
                  rhs: {<1>}
                  spids: [497]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_adjust_filename>} {<'/abc'>})
                      )
                    }
                  spids: [501]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <abc>)} {($ Id.VSub_DollarName '$filename')})
          ]
        )
    )
    (command.ShFunction
      name: test_file_resolve_expand_filename
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_resolve_expand_filename>} {<'/'>})
                      )
                    }
                  spids: [530]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <0>)} {($ Id.VSub_QMark '$?')})
            (C {<assertEquals>} {(SQ <'/'>)} {(DQ ($ Id.VSub_DollarName '$filename'))})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_resolve_expand_filename>} {<.>})
                      )
                    }
                  spids: [558]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <0>)} {($ Id.VSub_QMark '$?')})
            (C {<assertEquals>} {(SQ <'/'>)} 
              {
                (DQ 
                  (braced_var_sub
                    token: <Id.VSub_Name filename>
                    suffix_op: (suffix_op.Slice begin:{<Id.Lit_Digits 0>} length:{<Id.Lit_Digits 1>})
                  )
                )
              }
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filename)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<_Dbg_resolve_expand_filename>} {<'./fdafdsa'>})
                      )
                    }
                  spids: [592]
                )
              ]
            )
            (C {<assertEquals>} {(SQ <0>)} {($ Id.VSub_QMark '$?')})
            (C {<typeset>} {<-i>} 
              {<Id.Lit_VarLike 'size='> 
                (braced_var_sub
                  token: <Id.VSub_Name filename>
                  prefix_op: (Id.VSub_Pound)
                )
              }
            )
            (C {<assertEquals>} {(SQ <'/fdafdsa'>)} 
              {
                (DQ 
                  (braced_var_sub
                    token: <Id.VSub_Name filename>
                    suffix_op: 
                      (suffix_op.Slice
                        begin: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Minus
                            left: {($ Id.VSub_DollarName '$size')}
                            right: {<Id.Lit_Digits 8>}
                          )
                      )
                  )
                )
              }
            )
            (C {<assertNotEquals>} {(SQ <.>)} 
              {
                (DQ 
                  (braced_var_sub
                    token: <Id.VSub_Name filename>
                    suffix_op: 
                      (suffix_op.Slice
                        begin: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Minus
                            left: {($ Id.VSub_DollarName '$size')}
                            right: {<Id.Lit_Digits 1>}
                          )
                      )
                  )
                )
              }
            )
          ]
        )
    )
    (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: [656]
        )
      ]
    )
    (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: [662]
        )
      ]
    )
    (C {<.>} {(${ Id.VSub_Name abs_top_srcdir) <'test/unit/helper.sh'>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:srcdir)
          op: assign_op.Equal
          rhs: {<.>}
          spids: [678]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:srcdir)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: <Id.VSub_Name srcdir>
                suffix_op: (suffix_op.Unary tok:<Id.VOp1_DPercent '%%'> arg_word:{<Id.Lit_Slash '/'>})
              ) <'/'>
            }
          spids: [681]
        )
      ]
    )
    (C {<.>} {($ Id.VSub_DollarName '$abs_top_srcdir') <'/init/pre.sh'>})
    (C {<.>} {($ Id.VSub_DollarName '$abs_top_srcdir') <'/lib/filecache.sh'>})
    (C {<.>} {($ Id.VSub_DollarName '$abs_top_srcdir') <'/lib/file.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)})
      ]
    )
  ]
)