summaryrefslogtreecommitdiff
path: root/lib/warnings.t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-01-28 13:36:15 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-28 13:36:15 +0000
commit247c8d761ac3d8c85bd20779e586fcf0bebd9de9 (patch)
treed0d9b4758ac6328a4e3de3e07b626bf926417597 /lib/warnings.t
parent7d6a989b32d915de79323f6b48a8601b49a2ddf7 (diff)
downloadperl-247c8d761ac3d8c85bd20779e586fcf0bebd9de9.tar.gz
The "used only once" warnings (from gv_check) come
in pseudorandom hash order-- in EBCDIC the order is different. Add a new option that allow the warnings to come in any order (Paul Marquess). p4raw-id: //depot/perl@14465
Diffstat (limited to 'lib/warnings.t')
-rw-r--r--lib/warnings.t25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/warnings.t b/lib/warnings.t
index c88a4d9d79..009dee0cbb 100644
--- a/lib/warnings.t
+++ b/lib/warnings.t
@@ -119,18 +119,29 @@ for (@prgs){
my $prefix = ($results =~ s#^PREFIX(\n|$)##) ;
# any special options? (OPTIONS foo bar zap)
my $option_regex = 0;
+ my $option_random = 0;
if ($expected =~ s/^OPTIONS? (.+)\n//) {
foreach my $option (split(' ', $1)) {
if ($option eq 'regex') { # allow regular expressions
$option_regex = 1;
- } else {
+ }
+ elsif ($option eq 'random') { # all lines match, but in any order
+ $option_random = 1;
+ }
+ else {
die "$0: Unknown OPTION '$option'\n";
}
}
}
+ die "$0: can't have OPTION regex and random\n"
+ if $option_regex + option_random > 1;
if ( $results =~ s/^SKIPPED\n//) {
print "$results\n" ;
}
+ elsif ($option_random)
+ {
+ print "not " if !randomMatch($results, $expected);
+ }
elsif (($prefix && (( $option_regex && $results !~ /^$expected/) ||
(!$option_regex && $results !~ /^\Q$expected/))) or
(!$prefix && (( $option_regex && $results !~ /^$expected/) ||
@@ -144,3 +155,15 @@ for (@prgs){
foreach (@temps)
{ unlink $_ if $_ }
}
+
+sub randomMatch
+{
+ my $got = shift ;
+ my $expected = shift;
+
+ my @got = sort split "\n", $got ;
+ my @expected = sort split "\n", $expected ;
+
+ return "@got" eq "@expected";
+
+}