X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Flei.t;h=f7de1b711a836827b5fdbbff40473ad408eb3fce;hb=bcc02b78e322f87d942459de874ba68b3fc06c39;hp=2be9b4e846f6cc5e580d9a0f2a6cd83cf0afdba5;hpb=d0a75a98e47402eda0c1b3ef161a9c9f4f678f44;p=public-inbox.git diff --git a/t/lei.t b/t/lei.t index 2be9b4e8..f7de1b71 100644 --- a/t/lei.t +++ b/t/lei.t @@ -3,11 +3,9 @@ # License: AGPL-3.0+ use strict; use v5.10.1; use PublicInbox::TestCommon; use File::Path qw(rmtree); -use PublicInbox::Spawn qw(which); # this only tests the basic help/config/init/completion bits of lei; # actual functionality is tested in other t/lei-*.t tests -my $curl = which('curl'); my $home; my $home_trash = []; my $cleanup = sub { rmtree([@$home_trash, @_]) }; @@ -102,6 +100,9 @@ my $test_config = sub { is($lei_out, "tr00\n", "-c string value passed as-is"); lei_ok(qw(-c imap.debug=a -c imap.debug=b config --get-all imap.debug)); is($lei_out, "a\nb\n", '-c and --get-all work together'); + + lei_ok([qw(config -e)], { VISUAL => 'cat', EDITOR => 'cat' }); + is($lei_out, "[a]\n\tb = c\n", '--edit works'); }; my $test_completion = sub { @@ -114,7 +115,7 @@ my $test_completion = sub { %out = map { $_ => 1 } split(/\s+/s, $lei_out); for my $sw (qw(-f --format -o --output --mfolder --augment -a --mua --no-local --local --verbose -v - --save-as --no-remote --remote --torsocks + --save --no-save --no-remote --remote --torsocks --reverse -r )) { ok($out{$sw}, "$sw offered as `lei q' completion"); } @@ -131,8 +132,7 @@ my $test_completion = sub { } lei_ok(qw(_complete lei import)); %out = map { $_ => 1 } split(/\s+/s, $lei_out); - for my $sw (qw(--flags --no-flags --no-kw --kw --no-keywords - --keywords)) { + for my $sw (qw(--no-kw --kw)) { ok($out{$sw}, "$sw offered as `lei import' completion"); } }; @@ -155,8 +155,9 @@ my $test_fail = sub { } } lei_ok('sucks', \'yes, but hopefully less every day'); + like($lei_out, qr/loaded features/, 'loaded features shown'); SKIP: { - skip 'no curl', 3 unless which('curl'); + skip 'no curl', 3 unless require_cmd('curl', 1); lei(qw(q --only http://127.0.0.1:99999/bogus/ t:m)); is($? >> 8, 3, 'got curl exit for bogus URL'); lei(qw(q --only http://127.0.0.1:99999/bogus/ t:m -o), "$home/junk"); @@ -176,4 +177,8 @@ test_lei(sub { $test_fail->(); }); +test_lei({ mods => [] }, sub { + lei_ok('sucks', \'no optional modules required'); +}); + done_testing;