Skip to content

Commit 596ee7f

Browse files
Fergal Dalyschwern
authored andcommitted
import Test-Deep 0.100 from CPAN
git-cpan-module: Test-Deep git-cpan-version: 0.100 git-cpan-authorid: FDALY git-cpan-file: authors/id/F/FD/FDALY/Test-Deep-0.100.tar.gz
1 parent be21e07 commit 596ee7f

File tree

6 files changed

+23
-12
lines changed

6 files changed

+23
-12
lines changed

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
0.100
2+
3+
Apply patch from Andreas Koenig (ANDK) to cope with Perl 5.11's new
4+
REGEXP objects.
5+
16
0.099
27

38
Don't explode on perl's that don't have weakrefs. If they're not

META.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# http://module-build.sourceforge.net/META-spec.html
22
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
33
name: Test-Deep
4-
version: 0.099
4+
version: 0.100
55
version_from: ./lib/Test/Deep.pm
66
installdirs: perl
77
requires:

lib/Test/Deep.pm

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use vars qw(
2525
$Snobby $Expects $DNE $DNE_ADDR $Shallow
2626
);
2727

28-
$VERSION = '0.099';
28+
$VERSION = '0.100';
2929

3030
require Exporter;
3131
@ISA = qw( Exporter );
@@ -333,7 +333,7 @@ sub wrap
333333
{
334334
$cmp = scalref($data);
335335
}
336-
elsif($base eq 'Regexp')
336+
elsif($] <= 5.010 ? ($base eq 'Regexp') : ($base eq 'REGEXP'))
337337
{
338338
$cmp = regexpref($data);
339339
}
@@ -357,11 +357,13 @@ sub class_base
357357
$blessed = defined($blessed) ? $blessed : "";
358358
my $reftype = Scalar::Util::reftype($val);
359359

360-
if ($blessed eq "Regexp" and $reftype eq "SCALAR")
361-
{
362-
$reftype = "Regexp"
363-
}
364360

361+
if ($] <= 5.010) {
362+
if ($blessed eq "Regexp" and $reftype eq "SCALAR")
363+
{
364+
$reftype = "Regexp"
365+
}
366+
}
365367
return ($blessed, $reftype);
366368
}
367369
else

lib/Test/Deep.pod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,15 +839,15 @@ C<$got_v eq $expected_v>, we pass control over to the SC and let it do it's
839839
thing.
840840

841841
Test::Deep exports lots of SC constructors, to make it easy for you to use
842-
them in you tests scripts. For example is C<re("hello")> is just a handy way
842+
them in your test scripts. For example is C<re("hello")> is just a handy way
843843
of creating a Test::Deep::Regexp object that will match any string containing
844844
"hello". So
845845

846846
cmp_deeply([ 'a', 'b', 'hello world'], ['a', 'b', re("^hello")]);
847847

848848
will check C<'a' eq 'a'>, C<'b' eq 'b'> but when it comes to comparing
849849
C<'hello world'> and C<re("^hello")> it will see that
850-
$expected_v is an SC and so will pass control to the Test::Deep::Regex class
850+
$expected_v is an SC and so will pass control to the Test::Deep::Regexp class
851851
by do something like C<$expected_v->descend($got_v)>. The C<descend()>
852852
method should just return true or false.
853853

lib/Test/Deep/RegexpRef.pm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ sub descend
2222

2323
my $exp = $self->{val};
2424

25-
return 0 unless $self->test_class($got, "Regexp");
26-
return 0 unless $self->test_reftype($got, "SCALAR");
25+
if ($] <= 5.010) {
26+
return 0 unless $self->test_class($got, "Regexp");
27+
return 0 unless $self->test_reftype($got, "SCALAR");
28+
} else {
29+
return 0 unless $self->test_reftype($got, "REGEXP");
30+
}
2731

2832
return Test::Deep::descend($got, Test::Deep::regexprefonly($exp));
2933
}

t/deep_utils.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ use Test::Deep qw( cmp_deeply descend render_stack methods deep_diag class_base
2828

2929
my ($class, $base) = class_base($a);
3030
is($class, "Regexp", "class_base class regexp");
31-
is($base, "Regexp", "class_base base regexp");
31+
is($base, ($] <= 5.010 ? "Regexp" : "REGEXP"), "class_base base regexp");
3232
}

0 commit comments

Comments
 (0)