X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Flei.t;h=a80143ef5cf6f58e3055f67e823367aacf40e803;hb=ba1a1efbcd23ab472b3c5c030082a9064462680b;hp=d1f1cbc018290cdbee765f52f84b9d0a2d81bb82;hpb=fc7b32789a8d223e6550d9315216833fa602bd22;p=public-inbox.git diff --git a/t/lei.t b/t/lei.t index d1f1cbc0..a80143ef 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 { @@ -142,9 +143,13 @@ my $test_fail = sub { lei('-C', '/dev/null', 'q', 'whatever'); is($? >> 8, 1, 'chdir at beginning fails to /dev/null'); + lei_ok('q', "foo\n"); + like($lei_err, qr/trailing `\\n' removed/s, "noted `\\n' removal"); + for my $lk (qw(ei inbox)) { my $d = "$home/newline\n$lk"; - mkdir $d; + my $all = $lk eq 'ei' ? 'ALL' : 'all'; + File::Path::mkpath("$d/$all.git/objects"); open my $fh, '>', "$d/$lk.lock" or BAIL_OUT "open $d/$lk.lock"; for my $fl (qw(-I --only)) { ok(!lei('q', $fl, $d, 'whatever'), @@ -156,7 +161,7 @@ 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");