(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description spids:[21])
          op: Equal
          rhs: {(SQ <'add -e basic tests'>)}
          spids: [21]
        )
      ]
      spids: [21]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(file)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 54
          stdin_parts: [
            ('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')
          ]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(second-part)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 73
          stdin_parts: [
            ('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")
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m initial file\n'> 
          <'\n'>
        )
      }
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected-patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 124
          stdin_parts: [
            ('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")
          ]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(patch)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 149
          stdin_parts: [
            ('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')
          ]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 179
          stdin_parts: [
            ('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')
          ]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(echo)} {(DQ ('#!') ($ VSub_Name '$SHELL_PATH'))}]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(fake-editor.sh)})]
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_DGreat '>>'> fd:16777215 arg_word:{(fake-editor.sh)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 203
          stdin_parts: [('mv -f "$1" orig-patch &&\n') ('mv -f patch "$1"\n')]
        )
      ]
    )
    (C {(test_set_editor)} 
      {
        (DQ 
          (word_part.CommandSubPart
            command_list: (command.CommandList children:[(C {(pwd)})])
            left_token: <Left_CommandSub '$('>
            spids: [208 210]
          ) (/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)})
  ]
)