diff options
author | Karl Williamson <khw@khw-desktop.(none)> | 2010-07-03 11:55:57 -0600 |
---|---|---|
committer | Jesse Vincent <jesse@bestpractical.com> | 2010-07-04 21:43:44 +0100 |
commit | 2974a5b43750a3e186bc3e637d8d3ebbbfe23e07 (patch) | |
tree | 0b0d8d8c259b01986f5ed59ed39b9006c308d21b /lib | |
parent | 8f3c3cf14fbfd9a75364417ee2f959dcd2aee52b (diff) | |
download | perl-2974a5b43750a3e186bc3e637d8d3ebbbfe23e07.tar.gz |
charnames.t update because of rebase
Use of t/lib/common.pl caused some glitches; some behaviors of the
underlying is() functions changed, so revised .t to work under this
scheme.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/charnames.t | 65 |
1 files changed, 6 insertions, 59 deletions
diff --git a/lib/charnames.t b/lib/charnames.t index e8ce58eda0..1269c5202e 100644 --- a/lib/charnames.t +++ b/lib/charnames.t @@ -14,7 +14,7 @@ BEGIN { $SIG{__WARN__} = sub { push @WARN, @_ }; } -our $local_tests = 424; +our $local_tests = 440; # ---- For the alias extensions require "../t/lib/common.pl"; @@ -33,7 +33,7 @@ use charnames ":full"; EOE like($@, "above 0xFF"); - is($res, undef); + ok(! defined $res); $res = eval <<'EOE'; use charnames 'cyrillic'; @@ -164,14 +164,14 @@ sub to_bytes { use warnings; my $warning_count = @WARN; ok (! defined charnames::vianame("NONE SUCH")); - cmp_ok($warning_count, '==', @WARN, "Verify vianame doesn't warn on unknown names"); + cmp_ok($warning_count, '==', scalar @WARN, "Verify vianame doesn't warn on unknown names"); use bytes; is(charnames::vianame("GOTHIC LETTER AHSA"), 0x10330, "Verify vianame \\N{name} is unaffected by 'use bytes'"); is(charnames::vianame("U+FF"), chr(0xFF), "Verify vianame \\N{U+FF} is unaffected by 'use bytes'"); - cmp_ok($warning_count, '==', @WARN, "Verify vianame doesn't warn on legal inputs"); - is(charnames::vianame("U+100"), undef, "Verify vianame \\N{U+100} is undef under 'use bytes'"); - ok($warning_count == @WARN - 1 && $WARN[-1] =~ /above 0xFF/, "Verify vianame gives appropriate warning for previous test"); + cmp_ok($warning_count, '==', scalar @WARN, "Verify vianame doesn't warn on legal inputs"); + ok(! defined charnames::vianame("U+100"), "Verify vianame \\N{U+100} is undef under 'use bytes'"); + ok($warning_count == scalar @WARN - 1 && $WARN[-1] =~ /above 0xFF/, "Verify vianame gives appropriate warning for previous test"); } { @@ -607,59 +607,6 @@ is(charnames::viacode("U+00000000000FEED"), "ARABIC LETTER WAW ISOLATED FORM"); is("\N{VS256}", "\N{VARIATION SELECTOR-256}"); } -# ---- Alias extensions - -my $alifile = File::Spec->catfile(File::Spec->updir, qw(lib unicore xyzzy_alias.pl)); - -my @prgs; -{ - local $/ = undef; - @prgs = split "\n########\n", <DATA>; -} - -for (@prgs) { - my ($code, $exp) = ((split m/\nEXPECT\n/), '$'); - - # FILE is the code that generates any abbreviations - my ($prog, $fil) = ((split m/\nFILE\n/, $code), ""); - my $tmpfile = tempfile(); - open my $tmp, "> $tmpfile" or die "Could not open $tmpfile: $!"; - print $tmp $prog, "\n"; - close $tmp or die "Could not close $tmpfile: $!"; - if ($fil) { - $fil .= "\n"; - open my $ali, "> $alifile" or die "Could not open $alifile: $!"; - print $ali $fil; - close $ali or die "Could not close $alifile: $!"; - } - my $switch = ""; - my $res = runperl( switches => $switch, - progfile => $tmpfile, - stderr => 1 ); - my $status = $?; - $res =~ s/[\r\n]+$//; - $res =~ s/tmp\d+/-/g; # fake $prog from STDIN - $res =~ s/\n%[A-Z]+-[SIWEF]-.*$// # clip off DCL status msg - if $^O eq "VMS"; - $exp =~ s/[\r\n]+$//; - my $pfx = ($res =~ s/^PREFIX\n//); - my $rexp = qr{^$exp}; - my $expected = ""; # Unsure why this is here, as was never initialized - - SKIP: { - skip $res, 1, if $res =~ s/^SKIPPED\n//; - if (($pfx and $res !~ /^\Q$expected/) or - (!$pfx and $res !~ $rexp)) - { - fail("PROG:\n$prog\nFILE:\n${fil}EXPECTED:\n$exp\nGOT:\n$res"); - } else { - pass(""); - } - } - $fil or next; - 1 while unlink $alifile; -} - # [perl #30409] charnames.pm clobbers default variable $_ = 'foobar'; eval "use charnames ':full';"; |