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