This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix test that fails with new warny File::Path
[perl5.git] / t / uni / chr.t
CommitLineData
e4206093 1#!./perl -w
4c5ed6e2
TS
2
3BEGIN {
b5efbd1f 4 chdir 't' if -d 't';
e4206093 5 require './test.pl';
273be65c 6 skip_all_without_dynamic_extension('Encode');
1b413590 7 skip_all("no encoding pragma in EBCDIC") if $::IS_EBCDIC;
b5b7b9ad 8 skip_all_without_perlio();
4c5ed6e2
TS
9}
10
11use strict;
61a3fb80 12plan (tests => 8);
55673181 13no warnings 'deprecated';
4c5ed6e2
TS
14use encoding 'johab';
15
16ok(chr(0x7f) eq "\x7f");
17ok(chr(0x80) eq "\x80");
18ok(chr(0xff) eq "\xff");
19
20for my $i (127, 128, 255) {
21 ok(chr($i) eq pack('C', $i));
22}
23
61a3fb80
JL
24# [perl #83048]
25{
26 my $w;
27 local $SIG{__WARN__} = sub { $w .= $_[0] };
28 my $chr = chr(-1);
29 is($chr, "\x{fffd}", "invalid values become REPLACEMENT CHARACTER");
30 like($w, qr/^Invalid negative number \(-1\) in chr at /, "with a warning");
31}
32
4c5ed6e2 33__END__