Re: [PATCH] t/: work around one-shot variable assignment with test_must_fail

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

 



On 07/20/2010 06:19 PM, Erick Mattos wrote:
> 2010/7/20 Brandon Casey <casey@xxxxxxxxxxxxxxx>
>> No time to investigate, but here is an example patch and the
>> results of running the affected tests.

> You have made cosmetic changes which do not do the same as the original.

Nope, look closer.  The changes are not cosmetic.

Try this:

   run_it () { "$@"; }; run_it foo= true && echo success || echo failure

You probably get something like this (if you're using bash):

   bash: foo=: command not found

That's because the one-shot variable assignment doesn't work when
used like this.  It also means that the original tests which do:

   test_must_fail PAGER= git ...

are broken.  We ran into this problem a while back and fixed it in
the commit that I referenced (e2007832).  I fixed the new instances
in t2017, t3200, and t3301 in the patch that I sent.

For the tests in t2017 and t3200 that now fail, the originals seem to
expect 'git reflog show' to return non-zero when asked to show the reflog
for a ref which doesn't have a log.  reflog does not currently return
non-zero in this case.  Either the tests should be updated to reflect
the actual behavior of 'reflog show', or 'reflog show' should be updated
to return non-zero when passed a ref without a log.

-brandon

>> --->8---
>> From: Brandon Casey <drafnel@xxxxxxxxx>
>>
>> See e2007832552ccea9befed9003580c494f09e666e
>> ---
>>  t/t2017-checkout-orphan.sh |   36 ++++++++++++++++++++++++++++++------
>>  t/t3200-branch.sh          |    6 +++++-
>>  t/t3301-notes.sh           |    6 +++++-
>>  3 files changed, 40 insertions(+), 8 deletions(-)
>>
>> diff --git a/t/t2017-checkout-orphan.sh b/t/t2017-checkout-orphan.sh
>> index be88d4b..81cb393 100755
>> --- a/t/t2017-checkout-orphan.sh
>> +++ b/t/t2017-checkout-orphan.sh

>> @@ -80,17 +84,29 @@ test_expect_success '--orphan does not make reflog when core.logAllRefUpdates =
>>        git config core.logAllRefUpdates false &&
>>        git checkout --orphan epsilon &&
>>        ! test -f .git/logs/refs/heads/epsilon &&
>> -       test_must_fail PAGER= git reflog show epsilon &&
>> +       (
>> +               PAGER= &&
>> +               export PAGER &&
>> +               test_must_fail git reflog show epsilon
>> +       ) &&
>>        git commit -m Epsilon &&
>>        ! test -f .git/logs/refs/heads/epsilon &&
>> -       test_must_fail PAGER= git reflog show epsilon
>> +       (
>> +               PAGER= &&
>> +               export PAGER &&
>> +               test_must_fail git reflog show epsilon
>> +       )
>>  '

>> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
>> index 859b99a..bf7747d 100755
>> --- a/t/t3200-branch.sh
>> +++ b/t/t3200-branch.sh
>> @@ -237,7 +237,11 @@ test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates
>>        git config core.logAllRefUpdates false &&
>>        git checkout -b beta &&
>>        ! test -f .git/logs/refs/heads/beta &&
>> -       test_must_fail PAGER= git reflog show beta
>> +       (
>> +               PAGER= &&
>> +               export PAGER &&
>> +               test_must_fail git reflog show beta
>> +       )
>>  '
--
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]