Re: [RFC PATCHv2 07/16] t3600 (rm): add lots of missing &&
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Sep 24, 2010, 22:58 UTC
- Message-ID
- <AANLkTinqEfUukP_R=vwN+JvqNqB+NQMeLCv_4wONnX3h@mail.gmail.com>
- In-Reply-To
- <1285366976-22216-8-git-send-email-newren@gmail.com>
On Fri, Sep 24, 2010 at 22:22, Elijah Newren <newren@gmail.com> wrote:
> FIXME: I had to modify a few of the tests to make them pass again. Are my > modifications okay? Would a different method be preferred?
Show 26 quoted lines
> test_expect_success \ > 'Test that git rm --cached foo succeeds if the index matches the file' \ > - 'echo content > foo > - git add foo > - git commit -m foo > - echo "other content" > foo > + 'echo content > foo && > + git add foo && > + git commit -m foo && > + echo "other content" > foo && > git rm --cached foo' > > test_expect_success \ > 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' ' > - echo content > foo > - git add foo > - git commit -m foo > - echo "other content" > foo > - git add foo > - echo "yet another content" > foo > + git checkout HEAD -- foo && > + echo "other content" > foo && > + git add foo && > + echo "yet another content" > foo && > test_must_fail git rm --cached foo > '
Shouldn't that be:
test_when_finished "git checkout HEAD -- foo" &&
git rm --cached fooIn the above test? Then you don't have to clean up after someone else's mess, and the tests are more self-contained.