(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'add -e basic tests'>)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(file)} spids:[26])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {
              (DQ ('LO, praise of the prowess of people-kings\n') 
                ('of spear-armed Danes, in days long sped,\n') ('we have heard, and what honor the athelings won!\n') 
                ('Oft Scyld the Scefing from squadroned foes,\n') ('from many a tribe, the mead-bench tore,\n') ('awing the earls. Since erst he lay\n') 
                ('friendless, a foundling, fate repaid him:\n') ('for he waxed under welkin, in wealth he throve,\n') 
                ('till before him the folk, both far and near,\n') ('who house by the whale-path, heard his mandate,\n') ('gave him gifts:  a good king he!\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: T
          spids: [30]
        )
      ]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(second-part)} spids:[49])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {
              (DQ ('To him an heir was afterward born,\n') ('a son in his halls, whom heaven sent\n') 
                ('to favor the folk, feeling their woe\n') ('that erst they had lacked an earl for leader\n') ('so long a while; the Lord endowed him,\n') 
                ("the Wielder of Wonder, with world's renown.\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: T
          spids: [53]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m initial file\n'> 
          <'\n'>
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected-patch)} spids:[83])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {
              (DQ ('diff --git a/file b/file\n') ('index b9834b5..9020acb 100644\n') ('--- a/file\n') 
                ('+++ b/file\n') ('@@ -1,11 +1,6 @@\n') ('-LO, praise of the prowess of people-kings\n') 
                ('-of spear-armed Danes, in days long sped,\n') ('-we have heard, and what honor the athelings won!\n') 
                ('-Oft Scyld the Scefing from squadroned foes,\n') ('-from many a tribe, the mead-bench tore,\n') ('-awing the earls. Since erst he lay\n') 
                ('-friendless, a foundling, fate repaid him:\n') ('-for he waxed under welkin, in wealth he throve,\n') 
                ('-till before him the folk, both far and near,\n') ('-who house by the whale-path, heard his mandate,\n') ('-gave him gifts:  a good king he!\n') 
                ('+To him an heir was afterward born,\n') ('+a son in his halls, whom heaven sent\n') ('+to favor the folk, feeling their woe\n') 
                ('+that erst they had lacked an earl for leader\n') ('+so long a while; the Lord endowed him,\n') ("+the Wielder of Wonder, with world's renown.\n")
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: T
          spids: [87]
        )
      ]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(patch)} spids:[117])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {
              (DQ ('diff --git a/file b/file\n') ('index b9834b5..ef6e94c 100644\n') ('--- a/file\n') 
                ('+++ b/file\n') ('@@ -3,1 +3,333 @@ of spear-armed Danes, in days long sped,\n') 
                (' we have heard, and what honor the athelings won!\n') ('+\n') (' Oft Scyld the Scefing from squadroned foes,\n') 
                ('@@ -2,7 +1,5 @@ awing the earls. Since erst he lay\n') (' friendless, a foundling, fate repaid him:\n') ('+\n') 
                (' for he waxed under welkin, in wealth he throve,\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: T
          spids: [121]
        )
      ]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[141])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {
              (DQ ('diff --git a/file b/file\n') ('index b9834b5..ef6e94c 100644\n') ('--- a/file\n') 
                ('+++ b/file\n') ('@@ -1,10 +1,12 @@\n') (' LO, praise of the prowess of people-kings\n') 
                (' of spear-armed Danes, in days long sped,\n') (' we have heard, and what honor the athelings won!\n') ('+\n') 
                (' Oft Scyld the Scefing from squadroned foes,\n') (' from many a tribe, the mead-bench tore,\n') (' awing the earls. Since erst he lay\n') 
                (' friendless, a foundling, fate repaid him:\n') ('+\n') (' for he waxed under welkin, in wealth he throve,\n') 
                (' till before him the folk, both far and near,\n') (' who house by the whale-path, heard his mandate,\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: T
          spids: [145]
        )
      ]
    )
    (SimpleCommand
      words: [{(echo)} {(DQ ('#!') ($ VSub_Name '$SHELL_PATH'))}]
      redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(fake-editor.sh)} spids:[175])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_DGreat fd:16777215 arg_word:{(fake-editor.sh)} spids:[180])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: {('mv -f "$1" orig-patch &&\n') ('mv -f patch "$1"\n')}
          do_expansion: False
          here_end: EOF
          was_filled: T
          spids: [184]
        )
      ]
    )
    (C {(test_set_editor)} 
      {
        (DQ 
          (CommandSubPart
            command_list: (CommandList children:[(C {(pwd)})])
            left_token: <Left_CommandSub '$('>
            spids: [192 194]
          ) (/fake-editor.sh)
        )
      }
    )
    (C {(chmod)} {(a) (Lit_Other '+') (x)} {(fake-editor.sh)})
    (C {(test_expect_success)} {(SQ <'add -e'>)} 
      {
        (SQ <'\n'> <'\n'> <'\tcp second-part file &&\n'> <'\tgit add -e &&\n'> 
          <'\ttest_cmp second-part file &&\n'> <'\ttest_cmp orig-patch expected-patch &&\n'> <'\tgit diff --cached > out &&\n'> 
          <'\ttest_cmp out expected\n'> <'\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'add -e notices editor failure'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\techo change >>file &&\n'> 
          <'\ttest_must_fail env GIT_EDITOR=false git add -e &&\n'> <'\ttest_expect_code 1 git diff --exit-code\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)