Subject: | T:D:Any overloads the wrong operator |
Date: | Wed, 14 Nov 2012 14:51:42 +0000 |
To: | bug-Test-Deep [...] rt.cpan.org |
From: | Zefram <zefram [...] fysh.org> |
Both of these tests should fail:
perl -lwe 'use Test::More; use Test::Deep; cmp_deeply "a", re(qr/[ab]/) & re(qr/z/); cmp_deeply "a", (re(qr/a/) | re(qr/b/)) & re(qr/z/); done_testing()'
not ok 1
# Failed test at -e line 1.
# Using Regexp on (Part 2 of 2 in $data)
# got : 'a'
# expect : (?-xism:z)
ok 2
1..2
# Looks like you failed 1 test of 2.
The bug here is that Test::Deep::Any has overloaded "&", making "($a |
$b) & $c" on comparators act as "$a | $b | $c". Obviously it intended
to overload "|" instead.
Actually, as I've reported separately, these overloads are faulty anyway
because they modify their operands. I believe fixing that will require
removing the overload from Test::Deep::Any entirely. I'm reporting this
separately in case for some reason the overload doesn't get removed.
-zefram