Localize $@ in Locale::Maketext::maketext()
[p5sagit/p5-mst-13.2.git] / lib / Locale / Maketext / t / 30_local.t
1
2 require 5;
3 use Test;
4 BEGIN { plan tests => 4; }
5 use Locale::Maketext;
6 print "# Hi there...\n";
7 ok 1;
8
9 print "# --- Making sure that Perl globals are localized ---\n";
10
11 # declare a class...
12 {
13   package Woozle;
14   @ISA = ('Locale::Maketext');
15   %Lexicon = (
16     _AUTO => 1
17   );
18   keys %Lexicon; # dodges the 'used only once' warning
19 }
20
21 my $lh;
22 print "# Basic sanity:\n";
23 ok defined( $lh = Woozle->new() ) && ref($lh);
24
25 print "# Make sure \$@ is localized...\n";
26 $@ = 'foo';
27 ok $lh && $lh->maketext('Eval error: [_1]', $@), "Eval error: foo";
28
29 print "# Byebye!\n";
30 ok 1;