Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Deep CPAN distribution.

Report information
The Basics
Id: 85785
Status: resolved
Priority: 0/
Queue: Test-Deep

People
Owner: Nobody in particular
Requestors: victor [...] vsespb.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.110
Fixed in: (no value)



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
The stringified representation of regexps changes over time -- I would strongly suggest instead of writing them literally that you construct them with qr//.
From: victor [...] vsespb.ru
On Wed Aug 14 00:47:06 2013, ETHER wrote: Show quoted text
> The stringified representation of regexps changes over time -- I would > strongly suggest instead of writing them literally that you construct > them with qr//.
Fail is in this statement: cmp_deeply $re, qr!(^|/)dir\/!; i.e. constructed with qr//
From: victor [...] vsespb.ru
On Wed Aug 14 00:47:06 2013, ETHER wrote: Show quoted text
> The stringified representation of regexps changes over time -- I would > strongly suggest instead of writing them literally that you construct > them with qr//.
Ah, get it. This works better. Thanks! use strict; use warnings; use Test::More tests => 1; use Test::Deep; my $s = '(^|/)dir\/'; my $re = qr/$s/; my $s2 = $s; my $re2 = qr/$s2/; cmp_deeply $re, $re2;
I believe this can be closed…? -- rjbs