summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-10-04 21:45:16 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-10-04 21:45:16 -0700
commitbac7bf84e9730a396813e97488e4405bf1cfad9b (patch)
tree9eca6e53a19af182275b56bbd1a7d74ea6f62896
parentc30aeddd3b36c37c0ba6fe204d0eacb3edb28f0a (diff)
downloadperl-bac7bf84e9730a396813e97488e4405bf1cfad9b.tar.gz
Re-add a test deleted by the recent Locale::Maketext/$@ change
(and make it pass, too)
-rw-r--r--dist/Locale-Maketext/lib/Locale/Maketext.pm3
-rw-r--r--dist/Locale-Maketext/t/30_eval_dollar_at.t6
2 files changed, 8 insertions, 1 deletions
diff --git a/dist/Locale-Maketext/lib/Locale/Maketext.pm b/dist/Locale-Maketext/lib/Locale/Maketext.pm
index 71d358824d..103df9ec2c 100644
--- a/dist/Locale-Maketext/lib/Locale/Maketext.pm
+++ b/dist/Locale-Maketext/lib/Locale/Maketext.pm
@@ -198,6 +198,9 @@ sub maketext {
# If no failures, we'll re-set it back to what it was later.
my $at = $@;
+ # Copy @_ case one of its elements is $@.
+ @_ = @_;
+
# Look up the value:
my $value;
diff --git a/dist/Locale-Maketext/t/30_eval_dollar_at.t b/dist/Locale-Maketext/t/30_eval_dollar_at.t
index 523365de67..33581b358a 100644
--- a/dist/Locale-Maketext/t/30_eval_dollar_at.t
+++ b/dist/Locale-Maketext/t/30_eval_dollar_at.t
@@ -17,7 +17,7 @@ use warnings;
package main;
use strict;
use warnings;
-use Test::More tests => 10;
+use Test::More tests => 12;
my $lh = TEST->get_handle('en');
$@ = "foo";
@@ -49,3 +49,7 @@ is($@, '', '$@ is clean after failed _try_use');
is($err, undef, "die event calling failure_handler on bad code");
like($@, qr/^Error in maketexting "foo_fail":/ms, "\$@ is re-written as expected.");
}
+
+$@ = 'foo';
+is($lh->maketext('Eval error: [_1]', $@), 'Eval error: foo', "Make sure \$@ is localized when passed to maketext");
+is($@, 'foo', "\$@ wasn't modified during call");