summaryrefslogtreecommitdiff
path: root/t/test.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-03-03 08:30:16 +0000
committerNicholas Clark <nick@ccl4.org>2011-03-05 20:26:07 +0000
commit0973e8e6048d1899077f7c2ea4b16995516bf10e (patch)
treec6a722b4d10c2083ecfbcbde0527ab4aded0e34d /t/test.pl
parent76895e89c1e609b1a740ae887e6bcf7ece9d4222 (diff)
downloadperl-0973e8e6048d1899077f7c2ea4b16995516bf10e.tar.gz
In test.pl, change like() and unlike() to avoid copying the tested scalar.
This means that side effects of matching regexps on it are maintained, specifically the value of pos, making test.pl more useful for tests in t/re. This is a subtle divergence from the behaviour of Test::More::{like,unlike}
Diffstat (limited to 't/test.pl')
-rw-r--r--t/test.pl8
1 files changed, 4 insertions, 4 deletions
diff --git a/t/test.pl b/t/test.pl
index 40873770ca..26605ca8ff 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -325,12 +325,12 @@ sub like ($$@) { like_yn (0,@_) }; # 0 for -
sub unlike ($$@) { like_yn (1,@_) }; # 1 for un-
sub like_yn ($$$@) {
- my ($flip, $got, $expected, $name, @mess) = @_;
+ my ($flip, undef, $expected, $name, @mess) = @_;
my $pass;
- $pass = $got =~ /$expected/ if !$flip;
- $pass = $got !~ /$expected/ if $flip;
+ $pass = $_[1] =~ /$expected/ if !$flip;
+ $pass = $_[1] !~ /$expected/ if $flip;
unless ($pass) {
- unshift(@mess, "# got '$got'\n",
+ unshift(@mess, "# got '$_[1]'\n",
$flip
? "# expected !~ /$expected/\n" : "# expected /$expected/\n");
}