From: Rafael Laboissiere Date: Tue, 30 Jun 2015 21:54:15 +0000 (+0200) Subject: Plural/singular agreement in error message X-Git-Tag: release/2.6.0~224 X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=fd28ccea72e13b7e2dd7323af7c0cbaad9bb6663;hp=7f08ddfdcfd01a8bee87c9be99550b7c6f87bdef Plural/singular agreement in error message Make the error text message correctly respect the singular/plural agreement with the number of errors. We have now "with 1 error" instead of "with 1 errors". Also, change the 07_control_limit unit test accordingly. --- diff --git a/scripts/process b/scripts/process index bceb69c..4c38000 100755 --- a/scripts/process +++ b/scripts/process @@ -1070,7 +1070,7 @@ if (@control_bits) { address_only => 1, cc => 1, ); - my $error_text = $errors > 0 ? " (with $errors errors)":''; + my $error_text = $errors > 0 ? " (with $errors error" . ($errors > 1 ? "s" : "") . ")" : ""; my $reply = create_mime_message(['X-Loop' => $gMaintainerEmail, From => "$gMaintainerEmail ($gProject $gBug Tracking System)", diff --git a/scripts/service b/scripts/service index 9debab2..10fbbc0 100755 --- a/scripts/service +++ b/scripts/service @@ -509,7 +509,7 @@ if (!defined $header{'subject'} || $header{'subject'} eq "") { } # Error text here advertises how many errors there were -my $error_text = $errors > 0 ? " (with $errors errors)":''; +my $error_text = $errors > 0 ? " (with $errors error" . ($errors > 1 ? "s" : "") . ")" : ""; my @common_headers; push @common_headers, 'X-Loop',$gMaintainerEmail; diff --git a/t/07_control_limit.t b/t/07_control_limit.t index f4f600b..02cfc37 100644 --- a/t/07_control_limit.t +++ b/t/07_control_limit.t @@ -78,7 +78,7 @@ $SD_SIZE = 'control@bugs.something messages appear to have been sent out properly'); # make sure this fails -ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 errors): Munging a bug with limit_package_bar")) == 0, +ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 error): Munging a bug with limit_package_bar")) == 0, 'control@bugs.something'. "limit message failed with 1 error"); send_message(to => 'control@bugs.something', @@ -134,7 +134,7 @@ $SD_SIZE = 'control@bugs.something messages appear to have been sent out properly'); # make sure this fails -ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 errors): Munging a bug with limit_package_bar")) == 0, +ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 error): Munging a bug with limit_package_bar")) == 0, 'control@bugs.something'. "limit message failed with 1 error"); send_message(to => 'control@bugs.something',