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