1use strict;
2use Test;
3BEGIN {
4    if ("$]" >= 5.025) {
5      print "1..0 # Skip: encoding::warnings not supported on perl 5.26\n";
6      exit 0;
7    }
8    if (ord("A") != 65) {
9      print "1..0 # Skip: Encode not working on EBCDIC\n";
10      exit 0;
11    }
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}
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__
58