root/branches/release-40/t/lib/Test/Deep/RegexpMatches.pm @ 2583

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 
1use strict;
2use warnings;
3
4package Test::Deep::RegexpMatches;
5
6use Test::Deep::Array;
7
8use base 'Test::Deep::Array';
9
10use Scalar::Util qw( blessed );
11
12sub init
13{
14        my $self = shift;
15
16        my $val = shift;
17
18        $val = Test::Deep::array($val) unless
19                blessed($val) and UNIVERSAL::isa($val, "Test::Deep::Cmp");
20
21        $self->{val} = $val;
22        $self->{regex} = shift;
23}
24
25sub descend
26{
27        my $self = shift;
28
29        my $got = shift;
30
31        return Test::Deep::descend($got, $self->{val});
32}
33
34sub render_stack
35{
36        my $self = shift;
37
38        my $stack = shift;
39
40        $stack = "[$stack =~ $self->{regex}]";
41
42        return $stack;
43#       return $self->SUPER::render_stack($stack);
44}
45
46sub reset_arrow
47{
48        return 1;
49}
50
511;
Note: See TracBrowser for help on using the browser.