(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'git mailinfo and git mailsplit test'>)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:DATA)
          op: Equal
          rhs: {(DQ ($ VSub_Name '$TEST_DIRECTORY') (/t5100))}
          spids: [24]
        )
      ]
      spids: [24]
    )
    (C {(test_expect_success)} {(SQ <'split sample box'>)} 
      {
        (SQ <'git mailsplit -o. "$DATA/sample.mbox" >last &&\n'> <'\tlast=$(cat last) &&\n'> 
          <'\techo total is $last &&\n'> <'\ttest $(cat last) = 18'>
        )
      }
    )
    (FuncDef
      name: check_mailinfo
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:mail)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [55]
                )
                (assign_pair
                  lhs: (LhsName name:opt)
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                  spids: [58]
                )
              ]
              spids: [55]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:mo)
                  op: Equal
                  rhs: {(DQ ($ VSub_Name '$mail') ($ VSub_Name '$opt'))}
                  spids: [62]
                )
              ]
              spids: [62]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [
                    {(git)}
                    {(mailinfo)}
                    {(-u)}
                    {($ VSub_Name '$opt')}
                    {(DQ (msg) ($ VSub_Name '$mo'))}
                    {(DQ (patch) ($ VSub_Name '$mo'))}
                  ]
                  redirects: [
                    (Redir
                      op_id: Redir_Less
                      fd: 16777215
                      arg_word: {(DQ ($ VSub_Name '$mail'))}
                      spids: [87]
                    )
                    (Redir
                      op_id: Redir_Great
                      fd: 16777215
                      arg_word: {(DQ (info) ($ VSub_Name '$mo'))}
                      spids: [92]
                    )
                  ]
                )
                (AndOr
                  children: [
                    (C {(test_cmp)} {(DQ ($ VSub_Name '$DATA') (/msg) ($ VSub_Name '$mo'))} 
                      {(DQ (msg) ($ VSub_Name '$mo'))}
                    )
                    (AndOr
                      children: [
                        (C {(test_cmp)} {(DQ ($ VSub_Name '$DATA') (/patch) ($ VSub_Name '$mo'))} 
                          {(DQ (patch) ($ VSub_Name '$mo'))}
                        )
                        (C {(test_cmp)} {(DQ ($ VSub_Name '$DATA') (/info) ($ VSub_Name '$mo'))} 
                          {(DQ (info) ($ VSub_Name '$mo'))}
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [52]
        )
      spids: [47 51]
    )
    (ForEach
      iter_name: mail
      iter_words: [{(00) (Lit_Other '*')}]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (C {(test_expect_success)} {(DQ ('mailinfo ') ($ VSub_Name '$mail'))} 
              {
                (SQ <'\n'> <'\t\tcheck_mailinfo "$mail" "" &&\n'> 
                  <'\t\tif test -f "$DATA/msg$mail--scissors"\n'> <'\t\tthen\n'> <'\t\t\tcheck_mailinfo "$mail" --scissors\n'> <'\t\tfi &&\n'> 
                  <'\t\tif test -f "$DATA/msg$mail--no-inbody-headers"\n'> <'\t\tthen\n'> <'\t\t\tcheck_mailinfo "$mail" --no-inbody-headers\n'> <'\t\tfi &&\n'> 
                  <'\t\tif test -f "$DATA/msg$mail--message-id"\n'> <'\t\tthen\n'> <'\t\t\tcheck_mailinfo "$mail" --message-id\n'> <'\t\tfi\n'> <'\t'>
                )
              }
            )
          ]
          spids: [159 187]
        )
      spids: [155 16777215]
    )
    (C {(test_expect_success)} {(SQ <'split box with rfc2047 samples'>)} 
      {
        (SQ <'mkdir rfc2047 &&\n'> <'\tgit mailsplit -orfc2047 "$DATA/rfc2047-samples.mbox" \\\n'> 
          <'\t  >rfc2047/last &&\n'> <'\tlast=$(cat rfc2047/last) &&\n'> <'\techo total is $last &&\n'> <'\ttest $(cat rfc2047/last) = 11'>
        )
      }
    )
    (ForEach
      iter_name: mail
      iter_words: [{(rfc2047/00) (Lit_Other '*')}]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (C {(test_expect_success)} {(DQ ('mailinfo ') ($ VSub_Name '$mail'))} 
              {
                (SQ <'\n'> 
                  <'\t\tgit mailinfo -u "$mail-msg" "$mail-patch" <"$mail" >"$mail-info" &&\n'> <'\t\techo msg &&\n'> <'\t\ttest_cmp "$DATA/empty" "$mail-msg" &&\n'> <'\t\techo patch &&\n'> 
                  <'\t\ttest_cmp "$DATA/empty" "$mail-patch" &&\n'> <'\t\techo info &&\n'> <'\t\ttest_cmp "$DATA/rfc2047-info-$(basename $mail)" "$mail-info"\n'> <'\t'>
                )
              }
            )
          ]
          spids: [218 240]
        )
      spids: [214 16777215]
    )
    (C {(test_expect_success)} {(SQ <'respect NULs'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit mailsplit -d3 -o. "$DATA/nul-plain" &&\n'> 
          <'\ttest_cmp "$DATA/nul-plain" 001 &&\n'> <'\t(cat 001 | git mailinfo msg patch) &&\n'> <'\ttest_line_count = 4 patch\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Preserve NULs out of MIME encoded message'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit mailsplit -d5 -o. "$DATA/nul-b64.in" &&\n'> 
          <'\ttest_cmp "$DATA/nul-b64.in" 00001 &&\n'> <'\tgit mailinfo msg patch <00001 &&\n'> <'\ttest_cmp "$DATA/nul-b64.expect" patch\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'mailinfo on from header without name works'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tmkdir info-from &&\n'> 
          <'\tgit mailsplit -oinfo-from "$DATA/info-from.in" &&\n'> <'\ttest_cmp "$DATA/info-from.in" info-from/0001 &&\n'> 
          <'\tgit mailinfo info-from/msg info-from/patch \\\n'> <'\t  <info-from/0001 >info-from/out &&\n'> <'\ttest_cmp "$DATA/info-from.expect" info-from/out\n'> 
          <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'mailinfo finds headers after embedded From line'>)} 
      {
        (SQ <'\n'> <'\tmkdir embed-from &&\n'> 
          <'\tgit mailsplit -oembed-from "$DATA/embed-from.in" &&\n'> <'\ttest_cmp "$DATA/embed-from.in" embed-from/0001 &&\n'> 
          <'\tgit mailinfo embed-from/msg embed-from/patch \\\n'> <'\t  <embed-from/0001 >embed-from/out &&\n'> 
          <'\ttest_cmp "$DATA/embed-from.expect" embed-from/out\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'mailinfo on message with quoted >From'>)} 
      {
        (SQ <'\n'> <'\tmkdir quoted-from &&\n'> 
          <'\tgit mailsplit -oquoted-from "$DATA/quoted-from.in" &&\n'> <'\ttest_cmp "$DATA/quoted-from.in" quoted-from/0001 &&\n'> 
          <'\tgit mailinfo quoted-from/msg quoted-from/patch \\\n'> <'\t  <quoted-from/0001 >quoted-from/out &&\n'> 
          <'\ttest_cmp "$DATA/quoted-from.expect" quoted-from/msg\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'mailinfo unescapes with --mboxrd'>)} 
      {
        (SQ <'\n'> <'\tmkdir mboxrd &&\n'> <'\tgit mailsplit -omboxrd --mboxrd \\\n'> 
          <'\t\t"$DATA/sample.mboxrd" >last &&\n'> <'\ttest x"$(cat last)" = x2 &&\n'> <'\tfor i in 0001 0002\n'> <'\tdo\n'> 
          <'\t\tgit mailinfo mboxrd/msg mboxrd/patch \\\n'> <'\t\t  <mboxrd/$i >mboxrd/out &&\n'> <'\t\ttest_cmp "$DATA/${i}mboxrd" mboxrd/msg\n'> <'\tdone &&\n'> 
          <'\tsp=" " &&\n'> <'\techo "From " >expect &&\n'> <'\techo "From " >>expect &&\n'> <'\techo >> expect &&\n'> 
          <'\tcat >sp <<-INPUT_END &&\n'> <'\tFrom mboxrd Mon Sep 17 00:00:00 2001\n'> <'\tFrom: trailing spacer <sp@example.com>\n'> 
          <'\tSubject: [PATCH] a commit with trailing space\n'> <'\n'> <'\tFrom$sp\n'> <'\t>From$sp\n'> <'\n'> <'\tINPUT_END\n'> <'\n'> 
          <'\tgit mailsplit -f2 -omboxrd --mboxrd <sp >last &&\n'> <'\ttest x"$(cat last)" = x1 &&\n'> <'\tgit mailinfo mboxrd/msg mboxrd/patch <mboxrd/0003 &&\n'> 
          <'\ttest_cmp expect mboxrd/msg\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'mailinfo handles rfc2822 quoted-string'>)} 
      {
        (SQ <'\n'> <'\tmkdir quoted-string &&\n'> 
          <'\tgit mailinfo /dev/null /dev/null <"$DATA/quoted-string.in" \\\n'> <'\t\t>quoted-string/info &&\n'> <'\ttest_cmp "$DATA/quoted-string.expect" quoted-string/info\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'mailinfo handles rfc2822 comment'>)} 
      {
        (SQ <'\n'> <'\tmkdir comment &&\n'> 
          <'\tgit mailinfo /dev/null /dev/null <"$DATA/comment.in" \\\n'> <'\t\t>comment/info &&\n'> <'\ttest_cmp "$DATA/comment.expect" comment/info\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)