diff options
author | Eric Wong <e@80x24.org> | 2021-02-22 01:59:06 +0600 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-22 00:52:32 +0000 |
commit | 2ee341027929f716636aa7f03057a961d3a02d1c (patch) | |
tree | a85fe13baaeab9ae5740f8d06d56cf56bd131212 /t/lei-import.t | |
parent | 4f4fa052e6caf470632a2e8a8ea5113c97f0ba21 (diff) | |
download | public-inbox-2ee341027929f716636aa7f03057a961d3a02d1c.tar.gz |
t/lei*: drop $lei->(...) sub
lei() and lei_ok() are superior since they offer prototype checks and lei_ok() adds another check + description DRY-ness. The $lei sub was only bound to a variable since it was in t/lei.t and named subs don't work well with the key2sub() wrapper.
Diffstat (limited to 't/lei-import.t')
-rw-r--r-- | t/lei-import.t | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/t/lei-import.t b/t/lei-import.t index b691798a..46747a91 100644 --- a/t/lei-import.t +++ b/t/lei-import.t @@ -3,18 +3,18 @@ # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> use strict; use v5.10.1; use PublicInbox::TestCommon; test_lei(sub { -ok(!$lei->(qw(import -f bogus), 't/plack-qp.eml'), 'fails with bogus format'); +ok(!lei(qw(import -f bogus), 't/plack-qp.eml'), 'fails with bogus format'); like($lei_err, qr/\bbogus unrecognized/, 'gave error message'); -ok($lei->(qw(q s:boolean)), 'search miss before import'); +lei_ok(qw(q s:boolean), \'search miss before import'); unlike($lei_out, qr/boolean/i, 'no results, yet'); open my $fh, '<', 't/data/0001.patch' or BAIL_OUT $!; -ok($lei->([qw(import -f eml -)], undef, { %$lei_opt, 0 => $fh }), - 'import single file from stdin') or diag $lei_err; +lei_ok([qw(import -f eml -)], undef, { %$lei_opt, 0 => $fh }, + \'import single file from stdin') or diag $lei_err; close $fh; -ok($lei->(qw(q s:boolean)), 'search hit after import'); -ok($lei->(qw(import -f eml), 't/data/message_embed.eml'), - 'import single file by path'); +lei_ok(qw(q s:boolean), \'search hit after import'); +lei_ok(qw(import -f eml), 't/data/message_embed.eml', + \'import single file by path'); my $str = <<''; From: a@b @@ -22,17 +22,17 @@ Message-ID: <x@y> Status: RO my $opt = { %$lei_opt, 0 => \$str }; -ok($lei->([qw(import -f eml -)], undef, $opt), - 'import single file with keywords from stdin'); -$lei->(qw(q m:x@y)); +lei_ok([qw(import -f eml -)], undef, $opt, + \'import single file with keywords from stdin'); +lei_ok(qw(q m:x@y)); my $res = json_utf8->decode($lei_out); is($res->[1], undef, 'only one result'); is_deeply($res->[0]->{kw}, ['seen'], "message `seen' keyword set"); $str =~ tr/x/v/; # v@y -ok($lei->([qw(import --no-kw -f eml -)], undef, $opt), - 'import single file with --no-kw from stdin'); -$lei->(qw(q m:v@y)); +lei_ok([qw(import --no-kw -f eml -)], undef, $opt, + \'import single file with --no-kw from stdin'); +lei(qw(q m:v@y)); $res = json_utf8->decode($lei_out); is($res->[1], undef, 'only one result'); is_deeply($res->[0]->{kw}, [], 'no keywords set'); |