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,BAYES_00 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 17B981F8C6 for ; Tue, 7 Sep 2021 22:41:41 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] lei q|up: fix write counter for v2 Date: Tue, 7 Sep 2021 22:41:41 +0000 Message-Id: <20210907224141.17469-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It's a bit confusing to see "0 written to ..." when we actually wrote something. --- lib/PublicInbox/LeiToMail.pm | 1 + t/lei-q-save.t | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index 01f08384..dbf58df9 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -361,6 +361,7 @@ sub _v2_write_cb ($$) { $eml //= PublicInbox::Eml->new($bref); return if $dedupe && $dedupe->is_dup($eml, $smsg); $lei->{v2w}->ipc_do('add', $eml); # V2Writable->add + ++$lei->{-nr_write}; } } diff --git a/t/lei-q-save.t b/t/lei-q-save.t index 7aa9b84e..743a7b70 100644 --- a/t/lei-q-save.t +++ b/t/lei-q-save.t @@ -179,6 +179,8 @@ test_lei(sub { my (@before, @after); require PublicInbox::MboxReader; lei_ok(qw(q z:0.. -o), "v2:$v2"); + like($lei_err, qr/^# ([1-9][0-9]*) written to \Q$v2\E/sm, + 'non-zero write output to stderr'); lei_ok(qw(q z:0.. -o), "mboxrd:$home/before", '--only', $v2, '-j1,1'); open my $fh, '<', "$home/before"; PublicInbox::MboxReader->mboxrd($fh, sub { push @before, $_[0] });