]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/lei-p2q.t
lei p2q: exit with failure if format-patch fails
[public-inbox.git] / t / lei-p2q.t
index 1a2c2e4f2d201ad726502a59878964277594b69f..be2d437c709d6e67f962eed7fb8c14dbc11eee12 100644 (file)
@@ -6,9 +6,11 @@ require_git 2.6;
 require_mods(qw(json DBD::SQLite Search::Xapian));
 
 test_lei(sub {
+       ok(!lei(qw(p2q this-better-cause-format-patch-to-fail)),
+               'p2q fails on bogus arg');
        lei_ok(qw(p2q -w dfpost t/data/0001.patch));
        is($lei_out, "dfpost:6e006fd73b1d\n", 'pathname');
-       open my $fh, '+<', 't/data/0001.patch';
+       open my $fh, '+<', 't/data/0001.patch' or xbail "open: $!";
        lei_ok([qw(p2q -w dfpost -)], undef, { %$lei_opt, 0 => $fh });
        is($lei_out, "dfpost:6e006fd73b1d\n", '--stdin');
 
@@ -25,5 +27,8 @@ test_lei(sub {
                        "dfpost:6e006fd73b OR " .
                        "dfpost:6e006fd73\n",
                '3-byte chop');
+
+       lei_ok(qw(p2q t/data/message_embed.eml --want=dfb));
+       like($lei_out, qr/\bdfb:\S+/, 'got dfb off /dev/null file');
 });
 done_testing;