1use strict;
2use warnings;
3
4package Test::Deep::Regexp;
5
6use Test::Deep::Cmp;
7
8use Scalar::Util qw( blessed );
9
10sub init
11{
12	my $self = shift;
13
14	my $val = shift;
15
16	$val = ref $val ? $val : qr/$val/;
17
18	$self->{val} = $val;
19}
20
21sub descend
22{
23	my $self = shift;
24	my $got = shift;
25
26	my $re = $self->{val};
27
28	return ($got =~ $self->{val} ? 1 : 0;
29}
30
31sub diag_message
32{
33	my $self = shift;
34
35	my $where = shift;
36
37	return "Using Regexp on $where";
38}
39
40sub renderExp
41{
42	my $self = shift;
43
44	return "$self->{val}";
45}
46
471;
48