This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
test.pl: Allow NAME to be used with --FILE--
[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);
4c5ed6e2
TS
12use encoding 'johab';
13
14ok(chr(0x7f) eq "\x7f");
15ok(chr(0x80) eq "\x80");
16ok(chr(0xff) eq "\xff");
17
18for my $i (127, 128, 255) {
19 ok(chr($i) eq pack('C', $i));
20}
21
61a3fb80
JL
22# [perl #83048]
23{
24 my $w;
25 local $SIG{__WARN__} = sub { $w .= $_[0] };
26 my $chr = chr(-1);
27 is($chr, "\x{fffd}", "invalid values become REPLACEMENT CHARACTER");
28 like($w, qr/^Invalid negative number \(-1\) in chr at /, "with a warning");
29}
30
4c5ed6e2 31__END__