]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/lei-externals: favor "-o format:$PATHNAME" over "-f"
authorEric Wong <e@80x24.org>
Fri, 19 Feb 2021 12:09:50 +0000 (05:09 -0700)
committerEric Wong <e@80x24.org>
Fri, 19 Feb 2021 19:25:22 +0000 (19:25 +0000)
It'll be less ambiguous for inputs with "lei convert" and "lei import"

cf. https://public-inbox.org/meta/20210217044032.GA17934@dcvr/

lib/PublicInbox/LeiToMail.pm
t/lei-externals.t

index 8a2d9471f032f45f3d2efba36678c46d13f7f2a9..b90756aee4584c8a1dbea87be4e4e15bde75df70 100644 (file)
@@ -358,7 +358,7 @@ sub new {
                require PublicInbox::MboxReader if $lei->{opt}->{augment};
                (-d $dst || (-e _ && !-w _)) and die
                        "$dst exists and is not a writable file\n";
-               $self->can("eml2$fmt") or die "bad mbox --format=$fmt\n";
+               $self->can("eml2$fmt") or die "bad mbox format: $fmt\n";
                $self->{base_type} = 'mbox';
        } else {
                die "bad mail --format=$fmt\n";
index f61b7e52c95e4c1378b9d49c9ccbfed156cd0f37..edfbb2bf3eed1df1154151c28e8fc4bfd0fd488d 100644 (file)
@@ -117,18 +117,18 @@ test_lei(sub {
        unlike($lei_out, qr!https://example\.com/ibx/!s,
                'removed canonical URL');
 SKIP: {
-       ok(!$lei->(qw(q s:prefix -o /dev/null -f maildir)), 'bad maildir');
+       ok(!lei(qw(q s:prefix -o maildir:/dev/null)), 'bad maildir');
        like($lei_err, qr!/dev/null exists and is not a directory!,
                'error shown');
        is($? >> 8, 1, 'errored out with exit 1');
 
-       ok(!$lei->(qw(q s:prefix -f mboxcl2 -o), $home), 'bad mbox');
+       ok(!lei(qw(q s:prefix -o), "mboxcl2:$home"), 'bad mbox');
        like($lei_err, qr!\Q$home\E exists and is not a writable file!,
                'error shown');
        is($? >> 8, 1, 'errored out with exit 1');
 
-       ok(!$lei->(qw(q s:prefix -o /dev/stdout -f Mbox2)), 'bad format');
-       like($lei_err, qr/bad mbox --format=mbox2/, 'error shown');
+       ok(!lei(qw(q s:prefix -o Mbox2:/dev/stdout)), 'bad format');
+       like($lei_err, qr/bad mbox format: mbox2/, 'error shown');
        is($? >> 8, 1, 'errored out with exit 1');
 
        # note, on a Bourne shell users should be able to use either: