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-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 16ABD1FC11 for ; Thu, 25 Mar 2021 04:20:28 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 10/10] t/lei: add more diagnostics for failures Date: Thu, 25 Mar 2021 06:20:26 +0200 Message-Id: <20210325042026.11270-11-e@80x24.org> In-Reply-To: <20210325042026.11270-1-e@80x24.org> References: <20210325042026.11270-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This seems to error out while looping the test suite and I'm not 100% sure why. --- t/lei-import-maildir.t | 13 +++++++++---- t/lei-q-thread.t | 15 ++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/t/lei-import-maildir.t b/t/lei-import-maildir.t index bd89677a..6706b014 100644 --- a/t/lei-import-maildir.t +++ b/t/lei-import-maildir.t @@ -11,17 +11,20 @@ test_lei(sub { symlink(abs_path('t/data/0001.patch'), "$md/cur/x:2,S") or BAIL_OUT "symlink $md $!"; lei_ok(qw(import), $md, \'import Maildir'); + my $imp_err = $lei_err; lei_ok(qw(q s:boolean)); my $res = json_utf8->decode($lei_out); - like($res->[0]->{'s'}, qr/use boolean/, 'got expected result'); + like($res->[0]->{'s'}, qr/use boolean/, 'got expected result') + or diag explain($imp_err, $res); is_deeply($res->[0]->{kw}, ['seen'], 'keyword set'); is($res->[1], undef, 'only got one result'); lei_ok(qw(import), $md, \'import Maildir again'); + $imp_err = $lei_err; lei_ok(qw(q -d none s:boolean), \'lei q w/o dedupe'); my $r2 = json_utf8->decode($lei_out); - is_deeply($r2, $res, 'idempotent import'); - + is_deeply($r2, $res, 'idempotent import') + or diag explain($imp_err, $res); rename("$md/cur/x:2,S", "$md/cur/x:2,SR") or BAIL_OUT "rename: $!"; lei_ok('import', "maildir:$md", \'import Maildir after +answered'); lei_ok(qw(q -d none s:boolean), \'lei q after +answered'); @@ -33,8 +36,10 @@ test_lei(sub { symlink(abs_path('t/utf8.eml'), "$md/cur/u:2,ST") or BAIL_OUT "symlink $md $!"; lei_ok('import', "maildir:$md", \'import Maildir w/ trashed message'); + $imp_err = $lei_err; lei_ok(qw(q -d none m:testmessage@example.com)); $res = json_utf8->decode($lei_out); - is_deeply($res, [ undef ], 'trashed message not imported'); + is_deeply($res, [ undef ], 'trashed message not imported') + or diag explain($imp_err, $res); }); done_testing; diff --git a/t/lei-q-thread.t b/t/lei-q-thread.t index c999d12b..26d06eec 100644 --- a/t/lei-q-thread.t +++ b/t/lei-q-thread.t @@ -13,7 +13,8 @@ test_lei(sub { lei_ok qw(q -t m:testmessage@example.com); my $res = json_utf8->decode($lei_out); - is_deeply($res->[0]->{kw}, [ 'seen' ], 'q -t sets keywords'); + is_deeply($res->[0]->{kw}, [ 'seen' ], 'q -t sets keywords') or + diag explain($res); $eml = eml_load('t/utf8.eml'); $eml->header_set('References', $eml->header('Message-ID')); @@ -28,9 +29,9 @@ test_lei(sub { pop @$res; my %m = map { $_->{'m'} => $_ } @$res; is_deeply($m{'testmessage@example.com'}->{kw}, ['seen'], - 'flag set in direct hit'); - 'TODO' or is_deeply($m{'a-reply@miss'}->{kw}, ['draft'], - 'flag set in thread hit'); + 'flag set in direct hit') or diag explain($res); + is_deeply($m{'a-reply@miss'}->{kw}, ['draft'], + 'flag set in thread hit') or diag explain($res); lei_ok qw(q -t -t m:testmessage@example.com); $res = json_utf8->decode($lei_out); @@ -38,9 +39,9 @@ test_lei(sub { pop @$res; %m = map { $_->{'m'} => $_ } @$res; is_deeply($m{'testmessage@example.com'}->{kw}, ['flagged', 'seen'], - 'flagged set in direct hit'); - 'TODO' or is_deeply($m{'testmessage@example.com'}->{kw}, ['draft'], - 'flagged set in direct hit'); + 'flagged set in direct hit') or diag explain($res); + is_deeply($m{'a-reply@miss'}->{kw}, ['draft'], + 'set in thread hit') or diag explain($res); lei_ok qw(q -tt m:testmessage@example.com --only), "$ro_home/t2"; $res = json_utf8->decode($lei_out); is_deeply($res->[0]->{kw}, [ qw(flagged seen) ],