(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description spids:[21])
          op: Equal
          rhs: {(SQ <'Format-patch numbering options'>)}
          spids: [21]
        )
      ]
      spids: [21]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ <'\n'> <'\n'> <'\techo A > file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m First &&\n'> 
          <'\n'> <'\techo B >> file &&\n'> <'\tgit commit -a -m Second &&\n'> <'\n'> <'\techo C >> file &&\n'> 
          <'\tgit commit -a -m Third\n'> <'\n'>
        )
      }
    )
    (command.FuncDef
      name: test_num_no_numbered
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:cnt spids:[63])
                      op: Equal
                      rhs: 
                        {
                          (word_part.CommandSubPart
                            command_list: 
                              (command.CommandList
                                children: [
                                  (command.Pipeline
                                    children: [
                                      (C {(grep)} 
                                        {
                                          (DQ ('^Subject: ') (Lit_Other '\\') ('[PATCH') 
                                            (Lit_Other '\\') (']')
                                          )
                                        } {($ VSub_Number '$1')}
                                      )
                                      (C {(wc)} {(-l)})
                                    ]
                                    negated: F
                                  )
                                ]
                              )
                            left_token: <Left_CommandSub '$('>
                            spids: [64 82]
                          )
                        }
                      spids: [63]
                    )
                  ]
                  spids: [63]
                )
                (C {(test)} {($ VSub_Name '$cnt')} {(Lit_Other '=')} {($ VSub_Number '$2')})
              ]
            )
          ]
          spids: [60]
        )
      spids: [56 59]
    )
    (command.FuncDef
      name: test_single_no_numbered
      body: 
        (command.BraceGroup
          children: [(C {(test_num_no_numbered)} {($ VSub_Number '$1')} {(1)})]
          spids: [102]
        )
      spids: [98 101]
    )
    (command.FuncDef
      name: test_no_numbered
      body: 
        (command.BraceGroup
          children: [(C {(test_num_no_numbered)} {($ VSub_Number '$1')} {(2)})]
          spids: [118]
        )
      spids: [114 117]
    )
    (command.FuncDef
      name: test_single_cover_letter_numbered
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(grep)} {(DQ ('^Subject: ') (Lit_Other '\\') ('[PATCH 0/1') (Lit_Other '\\') (']'))} 
                  {($ VSub_Number '$1')}
                )
                (C {(grep)} {(DQ ('^Subject: ') (Lit_Other '\\') ('[PATCH 1/1') (Lit_Other '\\') (']'))} 
                  {($ VSub_Number '$1')}
                )
              ]
            )
          ]
          spids: [134]
        )
      spids: [130 133]
    )
    (command.FuncDef
      name: test_single_numbered
      body: 
        (command.BraceGroup
          children: [
            (C {(grep)} {(DQ ('^Subject: ') (Lit_Other '\\') ('[PATCH 1/1') (Lit_Other '\\') (']'))} 
              {($ VSub_Number '$1')}
            )
          ]
          spids: [171]
        )
      spids: [167 170]
    )
    (command.FuncDef
      name: test_numbered
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(grep)} {(DQ ('^Subject: ') (Lit_Other '\\') ('[PATCH 1/2') (Lit_Other '\\') (']'))} 
                  {($ VSub_Number '$1')}
                )
                (C {(grep)} {(DQ ('^Subject: ') (Lit_Other '\\') ('[PATCH 2/2') (Lit_Other '\\') (']'))} 
                  {($ VSub_Number '$1')}
                )
              ]
            )
          ]
          spids: [193]
        )
      spids: [189 192]
    )
    (C {(test_expect_success)} {(SQ <'single patch defaults to no numbers'>)} 
      {
        (SQ <'\n'> <'\tgit format-patch --stdout HEAD~1 >patch0.single &&\n'> 
          <'\ttest_single_no_numbered patch0.single\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'multiple patch defaults to numbered'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit format-patch --stdout HEAD~2 >patch0.multiple &&\n'> 
          <'\ttest_numbered patch0.multiple\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Use --numbered'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit format-patch --numbered --stdout HEAD~1 >patch1 &&\n'> 
          <'\ttest_single_numbered patch1\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'format.numbered = true'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit config format.numbered true &&\n'> 
          <'\tgit format-patch --stdout HEAD~2 >patch2 &&\n'> <'\ttest_numbered patch2\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'format.numbered && single patch'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit format-patch --stdout HEAD^ > patch3 &&\n'> 
          <'\ttest_single_numbered patch3\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'format.numbered && --no-numbered'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit format-patch --no-numbered --stdout HEAD~2 >patch4 &&\n'> 
          <'\ttest_no_numbered patch4\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'format.numbered && --keep-subject'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit format-patch --keep-subject --stdout HEAD^ >patch4a &&\n'> 
          <'\tgrep "^Subject: Third" patch4a\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'format.numbered = auto'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit config format.numbered auto &&\n'> 
          <'\tgit format-patch --stdout HEAD~2 > patch5 &&\n'> <'\ttest_numbered patch5\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'format.numbered = auto && single patch'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit format-patch --stdout HEAD^ > patch6 &&\n'> 
          <'\ttest_single_no_numbered patch6\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'format.numbered = auto && --no-numbered'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit format-patch --no-numbered --stdout HEAD~2 > patch7 &&\n'> 
          <'\ttest_no_numbered patch7\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'--start-number && --numbered'>)} 
      {
        (SQ <'\n'> <'\n'> 
          <'\tgit format-patch --start-number 3 --numbered --stdout HEAD~1 > patch8 &&\n'> <'\tgrep "^Subject: \\[PATCH 3/3\\]" patch8\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'single patch with cover-letter defaults to numbers'>)} 
      {
        (SQ <'\n'> <'\tgit format-patch --cover-letter --stdout HEAD~1 >patch9.single &&\n'> 
          <'\ttest_single_cover_letter_numbered patch9.single\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'Use --no-numbered and --cover-letter single patch'>)} 
      {
        (SQ <'\n'> <'\tgit format-patch --no-numbered --stdout --cover-letter HEAD~1 >patch10 &&\n'> 
          <'\ttest_no_numbered patch10\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)