diff options
author | 2019-02-13 21:15:00 +0000 | |
---|---|---|
committer | 2019-02-13 21:15:00 +0000 | |
commit | 9f11ffb7133c203312a01e4b986886bc88c7d74b (patch) | |
tree | 6618511204c614b20256e4ef9dea39a7b311d638 /gnu/usr.bin/perl/t/uni | |
parent | Import perl-5.28.1 (diff) | |
download | wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.tar.xz wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.zip |
Fix merge issues, remove excess files - match perl-5.28.1 dist
looking good sthen@, Great! bluhm@
Diffstat (limited to 'gnu/usr.bin/perl/t/uni')
26 files changed, 117 insertions, 281 deletions
diff --git a/gnu/usr.bin/perl/t/uni/attrs.t b/gnu/usr.bin/perl/t/uni/attrs.t index be064b992ab..81075a07481 100644 --- a/gnu/usr.bin/perl/t/uni/attrs.t +++ b/gnu/usr.bin/perl/t/uni/attrs.t @@ -4,8 +4,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); skip_all_if_miniperl("miniperl can't load attributes"); } @@ -37,7 +37,7 @@ like $@, qr/^Invalid SCALAR attribute: ["']?plǖgh["']? at/; eval '{my $x : plǖgh}'; like $@, qr/^Invalid SCALAR attribute: ["']?plǖgh["']? at/; eval '{my ($x,$y) : plǖgh(})}'; -like $@, qr/^Invalid SCALAR attribute: ["']?plǖgh\(}\)["']? at/; +like $@, qr/^Invalid SCALAR attribute: ["']?plǖgh\(\}\)["']? at/; # More syntax tests from the attributes manpage eval 'my $x : Şʨᚻ(10,ᕘ(7,3)) : 에ㄒ펜ሲ;'; diff --git a/gnu/usr.bin/perl/t/uni/cache.t b/gnu/usr.bin/perl/t/uni/cache.t index 4cd9a4845e7..e72a1b1aa8d 100644 --- a/gnu/usr.bin/perl/t/uni/cache.t +++ b/gnu/usr.bin/perl/t/uni/cache.t @@ -2,12 +2,13 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; set_up_inc('../lib'); + skip_all("utf8_heavy no longer used much"); skip_all_without_unicode_tables(); } plan tests => 1; -# Looks to see if a "do 'unicore/lib/Sc/Hira.pl'" is called more than once, by +# Looks to see if a "do 'unicore/lib/Scx/Hira.pl'" is called more than once, by # putting a compile sub first on the library path; # XXX Kludge: requires exact path, which might change, and has deep knowledge # of how utf8_heavy.pl works, which might also change. @@ -15,7 +16,7 @@ plan tests => 1; BEGIN { # Make sure catches compile time references $::count = 0; unshift @INC, sub { - $::count++ if $_[1] eq 'unicore/lib/Sc/Hira.pl'; + $::count++ if $_[1] eq 'unicore/lib/Scx/Hira.pl'; }; } diff --git a/gnu/usr.bin/perl/t/uni/case.pl b/gnu/usr.bin/perl/t/uni/case.pl index c3d5926cb83..a391fe385a2 100644 --- a/gnu/usr.bin/perl/t/uni/case.pl +++ b/gnu/usr.bin/perl/t/uni/case.pl @@ -1,5 +1,5 @@ BEGIN { - require "test.pl"; + require "./test.pl"; set_up_inc(qw(../lib .)); skip_all_without_unicode_tables(); } diff --git a/gnu/usr.bin/perl/t/uni/chomp.t b/gnu/usr.bin/perl/t/uni/chomp.t index ea86a25a629..35060eeeb87 100644 --- a/gnu/usr.bin/perl/t/uni/chomp.t +++ b/gnu/usr.bin/perl/t/uni/chomp.t @@ -3,43 +3,19 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; - skip_all_without_dynamic_extension('Encode'); - skip_all("encoding doesn't work with EBCDIC") if $::IS_EBCDIC; skip_all_without_perlio(); } use strict; -use Encode; -# %mbchars = (encoding => { bytes => utf8, ... }, ...); -# * pack('C*') is expected to return bytes even if ${^ENCODING} is true. -our %mbchars = ( - 'big-5' => { - pack('C*', 0x40) => pack('U*', 0x40), # COMMERCIAL AT - pack('C*', 0xA4, 0x40) => "\x{4E00}", # CJK-4E00 - }, - 'euc-jp' => { - pack('C*', 0xB0, 0xA1) => "\x{4E9C}", # CJK-4E9C - pack('C*', 0x8F, 0xB0, 0xA1) => "\x{4E02}", # CJK-4E02 - }, - 'shift-jis' => { - pack('C*', 0xA9) => "\x{FF69}", # halfwidth katakana small U - pack('C*', 0x82, 0xA9) => "\x{304B}", # hiragana KA - }, -); - -# 4 == @char; paired tests inside 3 nested loops, +# 6 == @char; paired tests inside 3 nested loops, # plus extra pair of tests in a loop, plus extra pair of tests. -plan tests => 2 * (4 ** 3 + 4 + 1) * (keys %mbchars); +plan tests => 6 ** 3 * 2 + 6 * 2 + 2; -for my $enc (sort keys %mbchars) { - no warnings 'deprecated'; - local ${^ENCODING} = find_encoding($enc); - use warnings 'deprecated'; - my @char = (sort(keys %{ $mbchars{$enc} }), - sort(values %{ $mbchars{$enc} })); +my @char = (pack('U*', 0x40), "\x{4E00}", "\x{4E9C}", "\x{4E02}", + "\x{FF69}", "\x{304B}"); - for my $rs (@char) { +for my $rs (@char) { local $/ = $rs; for my $start (@char) { for my $end (@char) { @@ -64,10 +40,10 @@ for my $enc (sort keys %mbchars) { my $got = chomp(); is ($got, 0); is (ref($_), "ARRAY", "chomp ref (no modify)"); - } - - $/ = ")"; # the last char of something like "ARRAY(0x80ff6e4)" - my $got = chomp(); - is ($got, 1); - ok (!ref($_), "chomp ref (modify)"); } + +$/ = ")"; # the last char of something like "ARRAY(0x80ff6e4)" +my $got = chomp(); +is ($got, 1); +ok (!ref($_), "chomp ref (modify)"); + diff --git a/gnu/usr.bin/perl/t/uni/chr.t b/gnu/usr.bin/perl/t/uni/chr.t deleted file mode 100644 index 390cdb1cc0f..00000000000 --- a/gnu/usr.bin/perl/t/uni/chr.t +++ /dev/null @@ -1,33 +0,0 @@ -#!./perl -w - -BEGIN { - chdir 't' if -d 't'; - require './test.pl'; - skip_all_without_dynamic_extension('Encode'); - skip_all("no encoding pragma in EBCDIC") if $::IS_EBCDIC; - skip_all_without_perlio(); -} - -use strict; -plan (tests => 8); -no warnings 'deprecated'; -use encoding 'johab'; - -ok(chr(0x7f) eq "\x7f"); -ok(chr(0x80) eq "\x80"); -ok(chr(0xff) eq "\xff"); - -for my $i (127, 128, 255) { - ok(chr($i) eq pack('C', $i)); -} - -# [perl #83048] -{ - my $w; - local $SIG{__WARN__} = sub { $w .= $_[0] }; - my $chr = chr(-1); - is($chr, "\x{fffd}", "invalid values become REPLACEMENT CHARACTER"); - like($w, qr/^Invalid negative number \(-1\) in chr at /, "with a warning"); -} - -__END__ diff --git a/gnu/usr.bin/perl/t/uni/greek.t b/gnu/usr.bin/perl/t/uni/greek.t index 7d73ecb23ea..fdc2a18cf6f 100644 --- a/gnu/usr.bin/perl/t/uni/greek.t +++ b/gnu/usr.bin/perl/t/uni/greek.t @@ -3,9 +3,7 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; - skip_all_without_dynamic_extension('Encode'); - skip_all("no encoding pragma in EBCDIC") if $::IS_EBCDIC; - skip_all_without_perlio(); + skip_all("encoding.pm is no longer supported by the perl core"); } plan tests => 72; diff --git a/gnu/usr.bin/perl/t/uni/gv.t b/gnu/usr.bin/perl/t/uni/gv.t index da48910ffb0..427831b2231 100644 --- a/gnu/usr.bin/perl/t/uni/gv.t +++ b/gnu/usr.bin/perl/t/uni/gv.t @@ -125,8 +125,8 @@ is (scalar %ᕘ, 0); my $E_grave = utf8::unicode_to_native(0xc8); my $pat = sprintf( # It took a lot of experimentation to get the backslashes right (khw) - "Argument \"\\*main::(?:PW\\\\x\\{%x}MPF" - . "|SKR\\\\x\\{%x}\\\\x\\{%x}\\\\x\\{%x})\" " + "Argument \"\\*main::(?:PW\\\\x\\{%x\\}MPF" + . "|SKR\\\\x\\{%x\\}\\\\x\\{%x\\}\\\\x\\{%x\\})\" " . "isn't numeric in sprintf", $O_grave, $E_grave, $E_grave, $E_grave); $pat = qr/$pat/; @@ -219,7 +219,7 @@ is (*{*Ẋ{GLOB}}, "*main::STDOUT"); is ($state, 'ok'); } -# [ID 20010526.001] localized glob loses value when assigned to +# [ID 20010526.001 (#7038)] localized glob loses value when assigned to $J=1; %J=(a=>1); @J=(1); local *J=*J; *J = sub{}; diff --git a/gnu/usr.bin/perl/t/uni/heavy.t b/gnu/usr.bin/perl/t/uni/heavy.t deleted file mode 100644 index c257dbce8bf..00000000000 --- a/gnu/usr.bin/perl/t/uni/heavy.t +++ /dev/null @@ -1,40 +0,0 @@ -#!./perl -w -# tests that utf8_heavy.pl doesn't use anything that prevents it loading -BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; - require './test.pl'; -} - -plan tests => 1; - -# see [perl #126593] -fresh_perl_is(<<'EOP', "", { stderr => 1 }, "doesn't break with \${^ENCODING}"); -no warnings qw(deprecated); -package Foo; -sub cat_decode { - # stolen from Encode.pm - my ( undef, undef, undef, $pos, $trm ) = @_; - my ( $rdst, $rsrc, $rpos ) = \@_[ 1, 2, 3 ]; - use bytes; - if ( ( my $npos = index( $$rsrc, $trm, $pos ) ) >= 0 ) { - $$rdst .= - substr( $$rsrc, $pos, $npos - $pos + length($trm) ); - $$rpos = $npos + length($trm); - return 1; - } - $$rdst .= substr( $$rsrc, $pos ); - $$rpos = length($$rsrc); - return q(); -} - -sub decode { - my (undef, $tmp) = @_; - utf8::decode($tmp); - $tmp; -} - -BEGIN { ${^ENCODING} = bless [], q(Foo) }; - -(my $tmp = q(abc)) =~ tr/abc/123/; -EOP diff --git a/gnu/usr.bin/perl/t/uni/latin2.t b/gnu/usr.bin/perl/t/uni/latin2.t index ba67e09b3f3..2e51598f885 100644 --- a/gnu/usr.bin/perl/t/uni/latin2.t +++ b/gnu/usr.bin/perl/t/uni/latin2.t @@ -3,9 +3,7 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; - skip_all_without_dynamic_extension('Encode'); - skip_all("no encoding pragma in EBCDIC") if $::IS_EBCDIC; - skip_all_without_perlio(); + skip_all("encoding.pm is no longer supported by the perl core"); } plan tests => 94; diff --git a/gnu/usr.bin/perl/t/uni/lex_utf8.t b/gnu/usr.bin/perl/t/uni/lex_utf8.t index c7f447f8efc..2913050017f 100755 --- a/gnu/usr.bin/perl/t/uni/lex_utf8.t +++ b/gnu/usr.bin/perl/t/uni/lex_utf8.t @@ -6,8 +6,8 @@ BEGIN { $| = 1; chdir 't' if -d 't'; - @INC = '../lib'; require './test.pl'; + set_up_inc('../lib'); require './charset_tools.pl'; skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader; skip_all_without_unicode_tables(); diff --git a/gnu/usr.bin/perl/t/uni/lower.t b/gnu/usr.bin/perl/t/uni/lower.t index 31fd1f71592..a215f60bc74 100644 --- a/gnu/usr.bin/perl/t/uni/lower.t +++ b/gnu/usr.bin/perl/t/uni/lower.t @@ -4,7 +4,7 @@ BEGIN { print("1..0 # miniperl: no Unicode::Normalize"); exit(0); } - require "uni/case.pl"; + require "./uni/case.pl"; } use feature 'unicode_strings'; diff --git a/gnu/usr.bin/perl/t/uni/method.t b/gnu/usr.bin/perl/t/uni/method.t index 4a12e3d5871..cc710ef1128 100644 --- a/gnu/usr.bin/perl/t/uni/method.t +++ b/gnu/usr.bin/perl/t/uni/method.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(. ../lib ../cpan/parent/lib); require "./test.pl"; require './charset_tools.pl'; + set_up_inc( qw(. ../lib ../cpan/parent/lib) ); } use strict; diff --git a/gnu/usr.bin/perl/t/uni/opcroak.t b/gnu/usr.bin/perl/t/uni/opcroak.t index 7bc90246af1..a16d9895db2 100644 --- a/gnu/usr.bin/perl/t/uni/opcroak.t +++ b/gnu/usr.bin/perl/t/uni/opcroak.t @@ -6,8 +6,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw '../lib ../dist/base/lib'; require './test.pl'; + set_up_inc(qw '../lib ../dist/base/lib'); } use utf8; diff --git a/gnu/usr.bin/perl/t/uni/overload.t b/gnu/usr.bin/perl/t/uni/overload.t index eb8d32a27cd..8e722c850e8 100644 --- a/gnu/usr.bin/perl/t/uni/overload.t +++ b/gnu/usr.bin/perl/t/uni/overload.t @@ -2,14 +2,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; require Config; import Config; require './test.pl'; require './charset_tools.pl'; require './loc_tools.pl'; + set_up_inc( '../lib' ); } -plan(tests => 215); +plan(tests => 217); package UTF8Toggle; use strict; @@ -287,3 +287,26 @@ foreach my $value ("\243", UTF8Toggle->new("\243")) { my $p = substr $text, 0, 1; is ($p, "\x{3075}"); } + +TODO: { + local $::TODO = 'RT #3054: Recursive operator overloading overflows the C stack'; + # XXX this test is expected to SEGV, and can produce + # sh: line 1: 5106 Segmentation fault + # on STDERR. So just completely disable for now + todo_skip($::TODO); + fresh_perl_is(<<'EOP', "ok\n", {}, 'RT #3054: Recursive operator overloading should not crash the interpreter'); + use overload '""' => sub { "$_[0]" }; + print bless {}, __PACKAGE__; + print "ok\n"; +EOP +} + +TODO: { + local $::TODO = 'RT #3270: Overloaded operators can not be treated as lvalues'; + fresh_perl_is(<<'EOP', '', {stderr => 1}, 'RT #3270: Overloaded operator that returns an lvalue can be used as an lvalue'); + use overload '.' => \˙ + sub dot : lvalue {my ($obj, $method) = @_; $obj -> {$method};} + my $o = bless {} => "main"; + $o.foo = "bar"; +EOP +} diff --git a/gnu/usr.bin/perl/t/uni/parser.t b/gnu/usr.bin/perl/t/uni/parser.t index ad905b01b0b..2d24f1d06d3 100644 --- a/gnu/usr.bin/perl/t/uni/parser.t +++ b/gnu/usr.bin/perl/t/uni/parser.t @@ -6,10 +6,11 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; + require './charset_tools.pl'; skip_all_without_unicode_tables(); } -plan (tests => 52); +plan (tests => 57); use utf8; use open qw( :utf8 :std ); @@ -191,11 +192,13 @@ like( $@, qr/Bad name after Foo'/, 'Bad name after Foo\'' ); { no warnings 'utf8'; + local $SIG{__WARN__} = sub { }; # The eval will also output a warning, + # which we ignore my $malformed_to_be = ($::IS_EBCDIC) # Overlong sequence ? "\x{74}\x{41}" : "\x{c0}\x{a0}"; CORE::evalbytes "use charnames ':full'; use utf8; my \$x = \"\\N{abc$malformed_to_be}\""; - like( $@, qr/Malformed UTF-8 character immediately after '\\N\{abc' at .* within string/, 'Malformed UTF-8 input to \N{}'); + like( $@, qr/Malformed UTF-8 character \(fatal\) at /, 'Malformed UTF-8 input to \N{}'); } # RT# 124216: Perl_sv_clear: Assertion @@ -228,3 +231,47 @@ like( $@, qr/Bad name after Foo'/, 'Bad name after Foo\'' ); {stderr => 1}, "RT# 124216"); } + +SKIP: { + + use Config; + if ($Config{uvsize} < 8) { + skip("test is only valid on 64-bit ints", 4); + } + else { + my $a; + my $b; + + # This caused a memory fault [perl #128738] + $b = byte_utf8a_to_utf8n("\xFE\x82\x80\x80\x80\x80\x80"); # 0x80000000 + eval "\$a = q ${b}abc${b}"; + is $@, "", + "No errors in eval'ing a string with large code point delimiter"; + is $a, 'abc', + "Got expected result in eval'ing a string with a large code point" + . " delimiter"; + + $b = byte_utf8a_to_utf8n("\xFE\x83\xBF\xBF\xBF\xBF\xBF"); # 0xFFFFFFFF + eval "\$a = q ${b}Hello, \\\\whirled!${b}"; + is $@, "", + "No errors in eval'ing a string with large code point delimiter"; + is $a, 'Hello, \whirled!', + "Got expected result in eval'ing a string with a large code point" + . " delimiter"; + } +} + + +# New tests go here ^^^^^ + +# Keep this test last, as it will mess up line number reporting for any +# subsequent tests. + +<<END; +${ +#line 57 +qq ϟϟ } +END +is __LINE__, 59, '#line directive and qq with uni delims inside heredoc'; + +# Put new tests above the line number tests. diff --git a/gnu/usr.bin/perl/t/uni/readline.t b/gnu/usr.bin/perl/t/uni/readline.t index c733f69e731..893a2908932 100644 --- a/gnu/usr.bin/perl/t/uni/readline.t +++ b/gnu/usr.bin/perl/t/uni/readline.t @@ -27,10 +27,13 @@ like($@, qr/Modification of a read-only value attempted/, '[perl #19566]'); } use strict; - -open ᕝ, '.' and sysread ᕝ, $_, 1; -my $err = $! + 0; -close ᕝ; +my $err; +{ + no warnings qw(deprecated); + open ᕝ, '.' and sysread ᕝ, $_, 1; + $err = $! + 0; + close ᕝ; +} SKIP: { skip "you can read directories as plain files", 2 unless( $err ); diff --git a/gnu/usr.bin/perl/t/uni/sprintf.t b/gnu/usr.bin/perl/t/uni/sprintf.t index 258ab541b45..58202395e84 100644 --- a/gnu/usr.bin/perl/t/uni/sprintf.t +++ b/gnu/usr.bin/perl/t/uni/sprintf.t @@ -2,8 +2,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw(../lib .); require "./test.pl"; + set_up_inc(qw(../lib .)); } plan tests => 52; @@ -113,7 +113,7 @@ $c = 0x200; } { - # 20010407.008 sprintf removes utf8-ness + # 20010407.008 (#6769) sprintf removes utf8-ness $a = sprintf "\x{1234}"; is((sprintf "%x %d", unpack("U*", $a), length($a)), "1234 1", '\x{1234}'); diff --git a/gnu/usr.bin/perl/t/uni/stash.t b/gnu/usr.bin/perl/t/uni/stash.t index 31d6c9d9b28..e329faab25b 100644 --- a/gnu/usr.bin/perl/t/uni/stash.t +++ b/gnu/usr.bin/perl/t/uni/stash.t @@ -170,7 +170,7 @@ plan( tests => 49 ); package FŌŌ3; sub 남えㄉ {}; my $anon = sub {}; - my $남えㄉ = eval q[\&남えㄉ]; + my $남えㄉ = eval q[*남えㄉ{CODE}]; # not \&남えㄉ; need a real GV package main; delete $FŌŌ3::{남えㄉ}; # make named anonymous diff --git a/gnu/usr.bin/perl/t/uni/title.t b/gnu/usr.bin/perl/t/uni/title.t index 458ca8efd19..45c895f7097 100644 --- a/gnu/usr.bin/perl/t/uni/title.t +++ b/gnu/usr.bin/perl/t/uni/title.t @@ -4,7 +4,7 @@ BEGIN { print("1..0 # miniperl: no Unicode::Normalize"); exit(0); } - require "uni/case.pl"; + require "./uni/case.pl"; } use feature 'unicode_strings'; diff --git a/gnu/usr.bin/perl/t/uni/tr_7jis.t b/gnu/usr.bin/perl/t/uni/tr_7jis.t deleted file mode 100644 index d1735f99389..00000000000 --- a/gnu/usr.bin/perl/t/uni/tr_7jis.t +++ /dev/null @@ -1,45 +0,0 @@ -#! perl -w -# -# This script is written intentionally in ISO-2022-JP -# requires Encode 1.83 or better to work -# -- dankogai - -BEGIN { - chdir 't' if -d 't'; - require './test.pl'; - skip_all_without_dynamic_extension('Encode'); - skip_all("no encoding pragma in EBCDIC") if $::IS_EBCDIC; - skip_all_without_perlio(); -} - -use strict; -plan(tests => 6); -no warnings 'deprecated'; -use encoding 'iso-2022-jp'; - -my @hiragana = map {chr} ord("$B$!(B")..ord("$B$s(B"); -my @katakana = map {chr} ord("$B%!(B")..ord("$B%s(B"); -my $hiragana = join('' => @hiragana); -my $katakana = join('' => @katakana); -my %h2k; @h2k{@hiragana} = @katakana; -my %k2h; @k2h{@katakana} = @hiragana; - -# print @hiragana, "\n"; - -my $str; - -$str = $hiragana; $str =~ tr/$B$!(B-$B$s(B/$B%!(B-$B%s(B/; -is($str, $katakana, "tr// # hiragana -> katakana"); -$str = $katakana; $str =~ tr/$B%!(B-$B%s(B/$B$!(B-$B$s(B/; -is($str, $hiragana, "tr// # hiragana -> katakana"); - -$str = $hiragana; eval qq(\$str =~ tr/$B$!(B-$B$s(B/$B%!(B-$B%s(B/); -is($str, $katakana, "eval qq(tr//) # hiragana -> katakana"); -$str = $katakana; eval qq(\$str =~ tr/$B%!(B-$B%s(B/$B$!(B-$B$s(B/); -is($str, $hiragana, "eval qq(tr//) # hiragana -> katakana"); - -$str = $hiragana; $str =~ s/([$B$!(B-$B$s(B])/$h2k{$1}/go; -is($str, $katakana, "s/// # hiragana -> katakana"); -$str = $katakana; $str =~ s/([$B%!(B-$B%s(B])/$k2h{$1}/go; -is($str, $hiragana, "s/// # hiragana -> katakana"); -__END__ diff --git a/gnu/usr.bin/perl/t/uni/tr_eucjp.t b/gnu/usr.bin/perl/t/uni/tr_eucjp.t deleted file mode 100644 index c5cccfa5616..00000000000 --- a/gnu/usr.bin/perl/t/uni/tr_eucjp.t +++ /dev/null @@ -1,44 +0,0 @@ -#! perl -w -# -# This script is written intentionally in EUC-JP -# -- dankogai - -BEGIN { - chdir 't' if -d 't'; - require './test.pl'; - skip_all_without_dynamic_extension('Encode'); - skip_all("no encoding pragma in EBCDIC") if $::IS_EBCDIC; - skip_all_without_perlio(); -} - -use strict; -plan(tests => 6); -no warnings 'deprecated'; -use encoding 'euc-jp'; - -my @hiragana = map {chr} ord("")..ord(""); -my @katakana = map {chr} ord("")..ord(""); -my $hiragana = join('' => @hiragana); -my $katakana = join('' => @katakana); -my %h2k; @h2k{@hiragana} = @katakana; -my %k2h; @k2h{@katakana} = @hiragana; - -# print @hiragana, "\n"; - -my $str; - -$str = $hiragana; $str =~ tr/-/-/; -is($str, $katakana, "tr// # hiragana -> katakana"); -$str = $katakana; $str =~ tr/-/-/; -is($str, $hiragana, "tr// # hiragana -> katakana"); - -$str = $hiragana; eval qq(\$str =~ tr/-/-/); -is($str, $katakana, "eval qq(tr//) # hiragana -> katakana"); -$str = $katakana; eval qq(\$str =~ tr/-/-/); -is($str, $hiragana, "eval qq(tr//) # hiragana -> katakana"); - -$str = $hiragana; $str =~ s/([-])/$h2k{$1}/go; -is($str, $katakana, "s/// # hiragana -> katakana"); -$str = $katakana; $str =~ s/([-])/$k2h{$1}/go; -is($str, $hiragana, "s/// # hiragana -> katakana"); -__END__ diff --git a/gnu/usr.bin/perl/t/uni/tr_sjis.t b/gnu/usr.bin/perl/t/uni/tr_sjis.t deleted file mode 100644 index fec525d6497..00000000000 --- a/gnu/usr.bin/perl/t/uni/tr_sjis.t +++ /dev/null @@ -1,44 +0,0 @@ -#!perl -w -# -# This script is written intentionally in Shift JIS -# -- dankogai - -BEGIN { - chdir 't' if -d 't'; - require './test.pl'; - skip_all_without_dynamic_extension('Encode'); - skip_all("no encoding pragma in EBCDIC") if $::IS_EBCDIC; - skip_all_without_perlio(); -} - -use strict; -plan(tests => 6); -no warnings 'deprecated'; -use encoding 'shiftjis'; - -my @hiragana = map {chr} ord("")..ord(""); -my @katakana = map {chr} ord("@")..ord(""); -my $hiragana = join('' => @hiragana); -my $katakana = join('' => @katakana); -my %h2k; @h2k{@hiragana} = @katakana; -my %k2h; @k2h{@katakana} = @hiragana; - -# print @hiragana, "\n"; - -my $str; - -$str = $hiragana; $str =~ tr/-/@-/; -is($str, $katakana, "tr// # hiragana -> katakana"); -$str = $katakana; $str =~ tr/@-/-/; -is($str, $hiragana, "tr// # hiragana -> katakana"); - -$str = $hiragana; eval qq(\$str =~ tr/-/@-/); -is($str, $katakana, "eval qq(tr//) # hiragana -> katakana"); -$str = $katakana; eval qq(\$str =~ tr/@-/-/); -is($str, $hiragana, "eval qq(tr//) # hiragana -> katakana"); - -$str = $hiragana; $str =~ s/([-])/$h2k{$1}/go; -is($str, $katakana, "s/// # hiragana -> katakana"); -$str = $katakana; $str =~ s/([@-])/$k2h{$1}/go; -is($str, $hiragana, "s/// # hiragana -> katakana"); -__END__ diff --git a/gnu/usr.bin/perl/t/uni/tr_utf8.t b/gnu/usr.bin/perl/t/uni/tr_utf8.t index 59782f1d5c0..7d16969fb26 100644 --- a/gnu/usr.bin/perl/t/uni/tr_utf8.t +++ b/gnu/usr.bin/perl/t/uni/tr_utf8.t @@ -1,21 +1,17 @@ #!perl -w # # This script is written intentionally in UTF-8 -# Requires Encode 1.83 or better # -- dankogai BEGIN { chdir 't' if -d 't'; require './test.pl'; - skip_all_without_dynamic_extension('Encode'); - skip_all("no encoding pragma in EBCDIC") if $::IS_EBCDIC; skip_all_without_perlio(); } use strict; plan(tests => 8); -no warnings 'deprecated'; -use encoding 'utf8'; +use utf8; my @hiragana = map {chr} ord("ぁ")..ord("ん"); my @katakana = map {chr} ord("ァ")..ord("ン"); diff --git a/gnu/usr.bin/perl/t/uni/universal.t b/gnu/usr.bin/perl/t/uni/universal.t index 56b41d44d9b..0874bed604f 100644 --- a/gnu/usr.bin/perl/t/uni/universal.t +++ b/gnu/usr.bin/perl/t/uni/universal.t @@ -5,9 +5,9 @@ BEGIN { chdir 't' if -d 't'; - @INC = qw '../lib ../dist/base/lib'; $| = 1; require "./test.pl"; + set_up_inc(qw '../lib ../dist/base/lib'); } use utf8; diff --git a/gnu/usr.bin/perl/t/uni/upper.t b/gnu/usr.bin/perl/t/uni/upper.t index 532f4bdd7be..252b51ce39f 100644 --- a/gnu/usr.bin/perl/t/uni/upper.t +++ b/gnu/usr.bin/perl/t/uni/upper.t @@ -4,7 +4,7 @@ BEGIN { print("1..0 # miniperl: no Unicode::Normalize"); exit(0); } - require "uni/case.pl"; + require "./uni/case.pl"; } use feature 'unicode_strings'; diff --git a/gnu/usr.bin/perl/t/uni/variables.t b/gnu/usr.bin/perl/t/uni/variables.t index 5601b9767f2..a1f7cc2d008 100644 --- a/gnu/usr.bin/perl/t/uni/variables.t +++ b/gnu/usr.bin/perl/t/uni/variables.t @@ -106,7 +106,7 @@ for ( 0x0 .. 0xff ) { else { $name = sprintf "\\x%02x, a C1 control", $ord; } - $syntax_error = $::IS_EBCDIC; + $syntax_error = 1; $deprecated = ! $syntax_error; } elsif ($chr =~ /\p{XIDStart}/) { @@ -114,7 +114,7 @@ for ( 0x0 .. 0xff ) { } elsif ($chr =~ /\p{XPosixSpace}/) { $name = sprintf "\\x%02x, a non-ASCII space character", $ord; - $syntax_error = $::IS_EBCDIC; + $syntax_error = 1; $deprecated = ! $syntax_error; } else { @@ -130,7 +130,7 @@ for ( 0x0 .. 0xff ) { "$name as a length-1 variable generates a syntax error"); $tests++; utf8::upgrade($chr); - evalbytes "no strict; use utf8; \$$chr = 4;", + eval "no strict; \$$chr = 4;", like($@, qr/ syntax\ error | Unrecognized\ character /x, " ... and the same under 'use utf8'"); $tests++; |