This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/re/regexp_unicode_prop.t: Avoid a TEST crash if failure
[perl5.git] / dist / encoding-warnings / t / 4-lexical.t
CommitLineData
6309fe6d
SP
1use strict;
2use Test;
cd08456d 3BEGIN {
b9071370
FC
4 if ("$]" >= 5.025) {
5 print "1..0 # Skip: encoding::warnings not supported on perl 5.26\n";
6 exit 0;
7 }
d4a45aba
KW
8 if (ord("A") != 65) {
9 print "1..0 # Skip: Encode not working on EBCDIC\n";
10 exit 0;
11 }
cd08456d
JH
12 use Config;
13 if ($Config::Config{'extensions'} !~ /\bEncode\b/) {
14 print "1..0 # Skip: Encode was not built\n";
15 exit 0;
16 }
17
18 plan tests => 3;
19}
6309fe6d
SP
20
21{
22 use encoding::warnings;
23 ok(encoding::warnings->VERSION);
24
25 if ($] < 5.009004) {
26 ok('skipped');
27 ok('skipped');
28 exit;
29 }
30
31 my ($a, $b, $c, $warned);
32
33 local $SIG{__WARN__} = sub {
34 if ($_[0] =~ /upgraded/) { $warned = 1 }
35 };
36
37 utf8::encode($a = chr(20000));
38 $b = chr(20000);
39 $c = $a . $b;
40 ok($warned);
41}
42
43{
44 my ($a, $b, $c, $warned);
45
46 local $SIG{__WARN__} = sub {
47 if ($_[0] =~ /upgraded/) { $warned = 1 }
48 };
49
50 utf8::encode($a = chr(20000));
51 $b = chr(20000);
52 $c = $a . $b;
53 ok(!$warned);
54}
55
56
57__END__