|
Revision 2583, 0.6 kB
(checked in by mpaschal, 18 months ago)
|
|
Add Test::Deep to t/lib, since we already use it in driver-tests.pl
BugzID: 79953
|
| Line | |
|---|
| 1 | use strict; |
|---|
| 2 | use warnings; |
|---|
| 3 | |
|---|
| 4 | package Test::Deep::RegexpRef; |
|---|
| 5 | |
|---|
| 6 | use Test::Deep::Ref; |
|---|
| 7 | |
|---|
| 8 | sub init |
|---|
| 9 | { |
|---|
| 10 | my $self = shift; |
|---|
| 11 | |
|---|
| 12 | my $val = shift; |
|---|
| 13 | |
|---|
| 14 | $self->{val} = $val; |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | sub descend |
|---|
| 18 | { |
|---|
| 19 | my $self = shift; |
|---|
| 20 | |
|---|
| 21 | my $got = shift; |
|---|
| 22 | |
|---|
| 23 | my $exp = $self->{val}; |
|---|
| 24 | |
|---|
| 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 | } |
|---|
| 31 | |
|---|
| 32 | return Test::Deep::descend($got, Test::Deep::regexprefonly($exp)); |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | sub renderGot |
|---|
| 36 | { |
|---|
| 37 | my $self = shift; |
|---|
| 38 | |
|---|
| 39 | return shift().""; |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | 1; |
|---|