diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-03-05 14:54:11 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-03-05 20:26:11 +0000 |
commit | ef23706341528838912bf72c2f11c8cd2d03ddcc (patch) | |
tree | 1f049d051a7d31a86711a06d8351fc91dc862db8 | |
parent | c1741bad1bfa5215302880114d7b0b580cf8f0c1 (diff) | |
download | perl-ef23706341528838912bf72c2f11c8cd2d03ddcc.tar.gz |
Move setting $IS_ASCII and $IS_EBCDIC from ReTest.pl to test.pl
As test.pl doesn't C<use vars> for either (and shouldn't start), modify the
users to fully qualify the variables, to avoid strict vars errors.
-rw-r--r-- | t/re/ReTest.pl | 9 | ||||
-rw-r--r-- | t/re/pat.t | 4 | ||||
-rw-r--r-- | t/re/pat_advanced.t | 20 | ||||
-rw-r--r-- | t/re/pat_rt_report.t | 2 | ||||
-rw-r--r-- | t/test.pl | 4 |
5 files changed, 17 insertions, 22 deletions
diff --git a/t/re/ReTest.pl b/t/re/ReTest.pl index 1bb3bfabac..5f1e6f3c79 100644 --- a/t/re/ReTest.pl +++ b/t/re/ReTest.pl @@ -7,18 +7,9 @@ use strict; use 5.010; use base qw/Exporter/; use Carp; -use vars qw( - $IS_ASCII - $IS_EBCDIC -); $| = 1; -my $ordA = ord ('A'); # This defines ASCII/UTF-8 vs EBCDIC/UTF-EBCDIC -# This defined the platform. -our $IS_ASCII = $ordA == 65; -our $IS_EBCDIC = $ordA == 193; - require './test.pl'; 1; diff --git a/t/re/pat.t b/t/re/pat.t index db0ccdf5b8..716e4fa937 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -1066,7 +1066,7 @@ sub run_tests { SKIP: { # Some constructs with Latin1 characters cause a utf8 string not # to match itself in non-utf8 - if ($IS_EBCDIC) { + if ($::IS_EBCDIC) { skip "Needs to be customized to run on EBCDIC", 6; } my $c = "\xc0"; @@ -1084,7 +1084,7 @@ sub run_tests { } SKIP: { # Make sure can override the formatting - if ($IS_EBCDIC) { + if ($::IS_EBCDIC) { skip "Needs to be customized to run on EBCDIC", 2; } use feature 'unicode_strings'; diff --git a/t/re/pat_advanced.t b/t/re/pat_advanced.t index 7775cd1d1c..0cd93a2cef 100644 --- a/t/re/pat_advanced.t +++ b/t/re/pat_advanced.t @@ -36,11 +36,11 @@ sub run_tests { $_ = "a\x{100}b"; ok(/(.)(\C)(\C)(.)/, $message); is($1, "a", $message); - if ($IS_ASCII) { # ASCII (or equivalent), should be UTF-8 + if ($::IS_ASCII) { # ASCII (or equivalent), should be UTF-8 is($2, "\xC4", $message); is($3, "\x80", $message); } - elsif ($IS_EBCDIC) { # EBCDIC (or equivalent), should be UTF-EBCDIC + elsif ($::IS_EBCDIC) { # EBCDIC (or equivalent), should be UTF-EBCDIC is($2, "\x8C", $message); is($3, "\x41", $message); } @@ -57,20 +57,20 @@ sub run_tests { my $message = '\C matches octet'; $_ = "\x{100}"; ok(/(\C)/g, $message); - if ($IS_ASCII) { + if ($::IS_ASCII) { is($1, "\xC4", $message); } - elsif ($IS_EBCDIC) { + elsif ($::IS_EBCDIC) { is($1, "\x8C", $message); } else { ok 0, "Unexpected platform", "ord ('A') = " . ord 'A'; } ok(/(\C)/g, $message); - if ($IS_ASCII) { + if ($::IS_ASCII) { is($1, "\x80", $message); } - elsif ($IS_EBCDIC) { + elsif ($::IS_EBCDIC) { is($1, "\x41", $message); } else { @@ -262,7 +262,7 @@ sub run_tests { ## Should probably put in tests for all the POSIX stuff, ## but not sure how to guarantee a specific locale...... - skip "Not an ASCII platform", 2 unless $IS_ASCII; + skip "Not an ASCII platform", 2 unless $::IS_ASCII; my $message = 'Test [[:cntrl:]]'; my $AllBytes = join "" => map {chr} 0 .. 255; (my $x = $AllBytes) =~ s/[[:cntrl:]]//g; @@ -284,7 +284,7 @@ sub run_tests { my $message = '. matches \n with /s'; my $str1 = "foo\nbar"; my $str2 = "foo\n\x{100}bar"; - my ($a, $b) = map {chr} $IS_ASCII ? (0xc4, 0x80) : (0x8c, 0x41); + my ($a, $b) = map {chr} $::IS_ASCII ? (0xc4, 0x80) : (0x8c, 0x41); my @a; @a = $str1 =~ /./g; is(@a, 6, $message); is("@a", "f o o b a r", $message); @a = $str1 =~ /./gs; is(@a, 7, $message); is("@a", "f o o \n b a r", $message); @@ -630,7 +630,7 @@ sub run_tests { # U+0085, U+00A0 need to be forced to be Unicode, the \x{100} does that. SKIP: { - skip "EBCDIC platform", 4 if $IS_EBCDIC; + skip "EBCDIC platform", 4 if $::IS_EBCDIC; # Do \x{0015} and \x{0041} match \s in EBCDIC? ok "<\x{100}\x{0085}>" =~ /<\x{100}\s>/, '\x{0085} in \s'; ok "<\x{0085}>" =~ /<\v>/, '\x{0085} in \v'; @@ -1724,7 +1724,7 @@ sub run_tests { # XXX: This set of tests is essentially broken, POSIX character classes # should not have differing definitions under Unicode. # There are property names for that. - skip "Tests assume ASCII", 4 unless $IS_ASCII; + skip "Tests assume ASCII", 4 unless $::IS_ASCII; my @notIsPunct = grep {/[[:punct:]]/ and not /\p{IsPunct}/} map {chr} 0x20 .. 0x7f; diff --git a/t/re/pat_rt_report.t b/t/re/pat_rt_report.t index 4ecd3cc160..18005e6a87 100644 --- a/t/re/pat_rt_report.t +++ b/t/re/pat_rt_report.t @@ -579,7 +579,7 @@ sub run_tests { SKIP: { - skip "In EBCDIC" if $IS_EBCDIC; + skip "In EBCDIC" if $::IS_EBCDIC; no warnings 'utf8'; $_ = pack 'U0C2', 0xa2, 0xf8; # Ill-formed UTF-8 my $ret = 0; @@ -24,6 +24,10 @@ my $planned; my $noplan; my $Perl; # Safer version of $^X set by which_perl() +# This defines ASCII/UTF-8 vs EBCDIC/UTF-EBCDIC +$::IS_ASCII = ord 'A' == 65; +$::IS_EBCDIC = ord 'A' == 193; + $TODO = 0; $NO_ENDING = 0; $Tests_Are_Passing = 1; |