Re: [PATCHv4 06/15] t3600 (rm): add lots of missing &&

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 1, 2010 at 4:48 AM, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote:
> Elijah Newren wrote:
>
>> Also delete unnecessary, failing code and add some test_when_finished
>> calls to make sure tests clean up after themselves.
>
> I don't understand this one.
>
> If tests clean up after themselves, each will restore some pristine
> state as though (at least as far as the other tests care) it had never
> run at all, right?
>
>> --- a/t/t3600-rm.sh
>> +++ b/t/t3600-rm.sh
>> @@ -38,37 +38,33 @@ test_expect_success \
>>
>> Âtest_expect_success \
>> Â Â Â'Test that git rm --cached foo succeeds if the index matches the file' \
>> - Â Â'echo content > foo
>> - Â Â git add foo
>> + Â Â'echo content > foo &&
>> + Â Â git add foo &&
>> Â Â Â git rm --cached foo'
>
> Before this runs: foo is empty, absent from index.
> After it runs: foo has content, still absent from index.
> Requires: nothing.
>
>> Â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 &&
>> + Â Â test_when_finished "git checkout HEAD -- foo" &&
>> Â Â Â git rm --cached foo'
>
> Before this runs: foo has content, absent from index.
> After this runs (without patch): foo has other content, absent from index.
> After this runs (with patch): foo has content, matching index.
> Requires: nothing.
>
>> Â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
>> + Â Â echo "other content" > foo &&
>> + Â Â git add foo &&
>> + Â Â echo "yet another content" > foo &&
>> + Â Â test_when_finished "git checkout HEAD -- foo" &&
>> Â Â Â test_must_fail git rm --cached foo
>> Â'
>
> Before this runs: see above.
> After this runs (without patch): foo has yet another content, absent from index.
> After this runs (with patch): foo has content, matching index.
> Requires (without patch): nothing.
> Requires (with patch): HEAD:foo is content.
>
> [etc]
>
> So if I understand correctly, this sacrifices the ability to
> skip individual tests. ÂWhat does one gain in return?

Good eye.  It does remove failing code and add correct && chaining,
but yes, it will fail if you skip sufficiently many individual tests.
I believe my original patch submission
(http://article.gmane.org/gmane.comp.version-control.git/157080) does
not suffer from this same problem.  Should I revert to it?

Elijah
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]