(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'git reset --patch'>)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./lib-patch-mode.sh)})
    (C {(test_expect_success)} {(PERL)} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\tmkdir dir &&\n'> <'\techo parent > dir/foo &&\n'> <'\techo dummy > bar &&\n'> 
          <'\tgit add dir &&\n'> <'\tgit commit -m initial &&\n'> <'\ttest_tick &&\n'> <'\ttest_commit second dir/foo head &&\n'> 
          <'\tset_and_save_state bar bar_work bar_index &&\n'> <'\tsave_head\n'>
        )
      }
    )
    (C {(test_expect_success)} {(PERL)} {(SQ <'saying "n" does nothing'>)} 
      {
        (SQ <'\n'> <'\tset_and_save_state dir/foo work work &&\n'> 
          <'\t(echo n; echo n) | git reset -p &&\n'> <'\tverify_saved_state dir/foo &&\n'> <'\tverify_saved_state bar\n'>
        )
      }
    )
    (C {(test_expect_success)} {(PERL)} {(SQ <'git reset -p'>)} 
      {
        (SQ <'\n'> <'\t(echo n; echo y) | git reset -p >output &&\n'> 
          <'\tverify_state dir/foo work head &&\n'> <'\tverify_saved_state bar &&\n'> <'\ttest_i18ngrep "Unstage" output\n'>
        )
      }
    )
    (C {(test_expect_success)} {(PERL)} {(SQ <'git reset -p HEAD^'>)} 
      {
        (SQ <'\n'> <'\t(echo n; echo y) | git reset -p HEAD^ >output &&\n'> 
          <'\tverify_state dir/foo work parent &&\n'> <'\tverify_saved_state bar &&\n'> <'\ttest_i18ngrep "Apply" output\n'>
        )
      }
    )
    (C {(test_expect_success)} {(PERL)} {(SQ <'git reset -p dir'>)} 
      {
        (SQ <'\n'> <'\tset_state dir/foo work work &&\n'> 
          <'\t(echo y; echo n) | git reset -p dir &&\n'> <'\tverify_state dir/foo work head &&\n'> <'\tverify_saved_state bar\n'>
        )
      }
    )
    (C {(test_expect_success)} {(PERL)} {(SQ <'git reset -p -- foo (inside dir)'>)} 
      {
        (SQ <'\n'> <'\tset_state dir/foo work work &&\n'> 
          <'\t(echo y; echo n) | (cd dir && git reset -p -- foo) &&\n'> <'\tverify_state dir/foo work head &&\n'> <'\tverify_saved_state bar\n'>
        )
      }
    )
    (C {(test_expect_success)} {(PERL)} {(SQ <'git reset -p HEAD^ -- dir'>)} 
      {
        (SQ <'\n'> <'\t(echo y; echo n) | git reset -p HEAD^ -- dir &&\n'> 
          <'\tverify_state dir/foo work parent &&\n'> <'\tverify_saved_state bar\n'>
        )
      }
    )
    (C {(test_expect_success)} {(PERL)} {(SQ <'none of this moved HEAD'>)} 
      {(SQ <'\n'> <'\tverify_saved_head\n'>)}
    )
    (C {(test_done)})
  ]
)