From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8A1FA1F523 for ; Fri, 30 Sep 2022 09:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1664529701; bh=b2arKV51aADN6XLvi1gnCJ1RWIZLmsac8rAPLdUPADA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=atdSb27xaAv8VyFIkgWVVQZFpY2qmsGoAjOwplC9esuFvp/6YpZnEA6+q7aSOvIKa DLNlDAPfjIimwLFKBowFUpUxlvaM6x1LyGxloliLuAwlfwLuRIhIAejsKMjhTjZ0v3 yndrinj1pBukhEpbK4KMMcFgmZ1ln5Ici/VTjhAI= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/4] t/altid_v2: improve test style Date: Fri, 30 Sep 2022 09:21:40 +0000 Message-Id: <20220930092140.3894047-5-e@80x24.org> In-Reply-To: <20220930092140.3894047-1-e@80x24.org> References: <20220930092140.3894047-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 ];