diff options
author | Eric Wong <e@80x24.org> | 2023-11-11 09:04:58 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-11 21:20:44 +0000 |
commit | 9e178030413ba697b8e07b87238bcc58de21b4dd (patch) | |
tree | 6636f97c40d5211345d091494c725d1cf0df7656 /t | |
parent | d002f24a9648d1499a16ed4dec84f05c0f849740 (diff) | |
download | public-inbox-9e178030413ba697b8e07b87238bcc58de21b4dd.tar.gz |
-mda now honors `--help' properly and invocations missing ORIGINAL_RECIPIENT now fail with EX_NOUSER. Helped-by: Leah Neukirchen <leah@vuxu.org> Link: https://public-inbox.org/meta/87msvlguqu.fsf@vuxu.org/
Diffstat (limited to 't')
-rw-r--r-- | t/mda.t | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -82,6 +82,13 @@ die $@ if $@; local $ENV{PI_EMERGENCY} = $faildir; local $ENV{HOME} = $home; local $ENV{ORIGINAL_RECIPIENT} = $addr; + ok(run_script([qw(-mda --help)], undef, + { 1 => \my $out, 2 => \my $err }), '-mda --help'); + like $out, qr/usage:/, 'usage shown w/ --help'; + ok(!run_script([qw(-mda --bogus)], undef, + { 1 => \$out, 2 => \$err }), '-mda --bogus fails'); + like $err, qr/usage:/, 'usage shown on bogus switch'; + my $in = <<EOF; From: Me <me\@example.com> To: You <you\@example.com> @@ -91,6 +98,17 @@ Subject: hihi Date: Thu, 01 Jan 1970 00:00:00 +0000 EOF + { + local $ENV{PATH} = $main_path; + ok(!run_script(['-mda'], { ORIGINAL_RECIPIENT => undef }, + { 0 => \$in, 2 => \$err }), + 'missing ORIGINAL_RECIPIENT fails'); + is($? >> 8, 67, 'got EX_NOUSER'); + like $err, qr/\bORIGINAL_RECIPIENT\b/, + 'ORIGINAL_RECIPIENT noted in stderr'; + is unlink(glob("$faildir/*/*")), 1, 'unlinked failed message'; + } + # ensure successful message delivery { local $ENV{PATH} = $main_path; |