From 0a8406bbb33f8ea1e432ce3e61796e389535642c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 30 Sep 2022 09:21:40 +0000 Subject: [PATCH] t/altid_v2: improve test style Favor `is' for equality checks since it reports differences, and `xbail' over `BAIL_OUT' since it's easier-to-type w/o caps and more powerful. These are just things noticed while I was looking at another odd failure on CentOS 7.x with this test, but I suspect it was a transient failure caused by running the test suite from multiple terminals in parallel. --- t/altid_v2.t | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/altid_v2.t b/t/altid_v2.t index 281a09d5..c62252c1 100644 --- a/t/altid_v2.t +++ b/t/altid_v2.t @@ -14,9 +14,9 @@ my $ibx = create_inbox 'v2', version => 2, indexlevel => 'medium', altid => $altid, sub { my ($im, $ibx) = @_; my $mm = PublicInbox::Msgmap->new_file("$ibx->{inboxdir}/$another", 2); - $mm->mid_set(1234, 'a@example.com') == 1 or BAIL_OUT 'mid_set once'; - ok(0 == $mm->mid_set(1234, 'a@example.com'), 'mid_set not idempotent'); - ok(0 == $mm->mid_set(1, 'a@example.com'), 'mid_set fails with dup MID'); + is($mm->mid_set(1234, 'a@example.com'), 1, 'mid_set') or xbail 'once'; + is($mm->mid_set(1234, 'a@example.com')+0, 0, 'mid_set not idempotent'); + is($mm->mid_set(1, 'a@example.com')+0, 0, 'mid_set fails with dup MID'); $im->add(PublicInbox::Eml->new(<<'EOF')) or BAIL_OUT; From: a@example.com To: b@example.com @@ -27,8 +27,8 @@ hello world gmane:666 EOF }; my $mm = PublicInbox::Msgmap->new_file("$ibx->{inboxdir}/$another", 2); -ok(0 == $mm->mid_set(1234, 'a@example.com'), 'mid_set not idempotent'); -ok(0 == $mm->mid_set(1, 'a@example.com'), 'mid_set fails with dup MID'); +is($mm->mid_set(1234, 'a@example.com') + 0, 0, 'mid_set not idempotent'); +is($mm->mid_set(1, 'a@example.com') + 0, 0, 'mid_set fails with dup MID'); my $mset = $ibx->search->mset('gmane:1234'); my $msgs = $ibx->search->mset_to_smsg($ibx, $mset); $msgs = [ map { $_->{mid} } @$msgs ]; -- 2.44.0