Subject: | cmp_deeply sometimes wrong compare regexps in perl 5.8.9 |
PoC:
use strict;
use warnings;
use Test::More tests => 4;
use Test::Deep;
my $s = '(^|/)dir\/';
my $string_out = "STRING:".$s."\n";
my $re = qr/$s/;
my $re_out = "RE:".$re."\n";
print $string_out;
print $re_out;
ok $string_out, 'STRING:(^|/)dir\/';
ok $re_out, 'RE:(?-xism:(^|/)dir\/)';
ok $re, qr!(^|/)dir\/!;
cmp_deeply $re, qr!(^|/)dir\/!;
print "Test::More::VERSION $Test::More::VERSION\n";
print "Test::Deep::VERSION $Test::Deep::VERSION\n";
print "Perl version $]\n";
__END__
1..4
STRING:(^|/)dir\/
RE:(?-xism:(^|/)dir\/)
ok 1 - STRING:(^|/)dir\/
ok 2 - RE:(?-xism:(^|/)dir\/)
ok 3 - (?-xism:(^|/)dir\/)
ok 4
Test::More::VERSION 0.98
Test::Deep::VERSION 0.11
Perl version 5.010001
1..4
STRING:(^|/)dir\/
RE:(?-xism:(^|/)dir\/)
ok 1 - STRING:(^|/)dir\/
ok 2 - RE:(?-xism:(^|/)dir\/)
ok 3 - (?-xism:(^|/)dir/)
not ok 4
# Failed test at poc.pl line 18.
# Compared m/$data/
# got : (?-xism:(^|/)dir\/)
# expect : (?-xism:(^|/)dir/)
Test::More::VERSION 0.98
Test::Deep::VERSION 0.11
Perl version 5.008009
# Looks like you failed 1 test of 4.
seen in the wild:
fails: http://www.cpantesters.org/cpan/report/d7046a10-c6f4-11e2-aa99-ea7ed025f8fd
passes: http://www.cpantesters.org/cpan/report/d8c58690-c6e5-11e2-9df6-d9c2d4d0764b