]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei edit-search: fix and add a (weak) test
authorEric Wong <e@80x24.org>
Wed, 9 Jun 2021 00:11:11 +0000 (00:11 +0000)
committerEric Wong <e@80x24.org>
Wed, 9 Jun 2021 00:12:23 +0000 (00:12 +0000)
This broke recently and lacked an automated test, so rely on
EDITOR=cat to ensure we have some coverage.

Fixes: d2670108f71b1eff ("pkt_op: make pkt_do an OO method")
lib/PublicInbox/LeiEditSearch.pm
t/lei-q-save.t

index 13713d24570906dfc6d2b88720b3bf2a1188abd8..82dfbf63c411356138f27b611986747b0e006fe3 100644 (file)
@@ -19,7 +19,7 @@ sub lei_edit_search {
        my ($op_c, $op_p) = PublicInbox::PktOp->pair;
        # $op_p will EOF when $EDITOR is done
        $op_c->{ops} = { '' => [$lss->can('edit_done'), $lss, $lei] };
-       $lei->send_exec_cmd([ @$lei{qw(0 1 2)}, $op_p ], \@cmd, {});
+       $lei->send_exec_cmd([ @$lei{qw(0 1 2)}, $op_p->{op_p} ], \@cmd, {});
 }
 
 *_complete_edit_search = \&PublicInbox::LeiUp::_complete_up;
index 694b33b2e1998914fc0e9272a9b69e8f8dd3327c..6c5920883a7cbae9481c982a2f611b1772834ca0 100644 (file)
@@ -195,5 +195,8 @@ test_lei(sub {
                        glob("$v2s/git/0.git/objects/*/*")));
        ok($shared < $orig, 'fewer bytes stored with --shared') or
                diag "shared=$shared orig=$orig";
+
+       lei_ok([qw(edit-search), $v2s], { VISUAL => 'cat', EDITOR => 'cat' });
+       like($lei_out, qr/^\[lei/sm, 'edit-search can cat');
 });
 done_testing;