[PATCH] test-lib: add tests for test_might_fail
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jan 16, 2021, 14:41 UTC
- Message-ID
- <20210116144147.14036-1-avarab@gmail.com>
- In-Reply-To
- <YAFiFW7D1qD7ZJ8I@coredump.intra.peff.net>
This trivial sibling command of test_must_fail added in fdf1bc48ca (t7006: guard cleanup with test_expect_success, 2010-04-14) didn't have any tests. Let's add at least a basic one.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> ---
On Fri, Jan 15 2021, Jeff King wrote:
Show 12 quoted lines
> On Fri, Jan 15, 2021 at 12:35:10AM +0100, Ævar Arnfjörð Bjarmason wrote: > >> +test_expect_success 'test_might_fail is like test_must_fail ok=' ' >> + ! test_must_fail git version && >> + ! test_must_fail ok= git version && >> + test_might_fail git version >> +' > > The title confuses me. Isn't might_fail like "must_fail ok=success"? > > And certainly the code here shows us expecting the _opposite_ of what > "Must_fail ok=" does.
Yes, this made no sense. Here's a sensibe test.
Junio: This is a stand-alone patch now. I'm splitting this off from my WIP v2 of the "set -o pipefail" series.
t/t0000-basic.sh | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index f4ba2e8c85..efaf7ec4d9 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -1326,4 +1326,9 @@ test_expect_success 'test_must_fail rejects a non-git command with env' ' grep -F "test_must_fail: only '"'"'git'"'"' is allowed" err ' +test_expect_success 'test_might_fail is like test_must_fail ok=success' ' + test_must_fail ok=success git version && + test_might_fail git version +' + test_done
-- 2.29.2.222.g5d2a92d10f8