Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Test-Deep as_test_deep_cmp branch

3 views
Skip to first unread message

Ricardo Signes

unread,
Dec 18, 2016, 9:15:02 AM12/18/16
to per...@perl.org
I've filed a PR against Test-Deep:

https://github.com/rjbs/Test-Deep/pull/52

addresses

https://github.com/rjbs/Test-Deep/issues/50

The idea is:

When you call cmp_deeply($have, $want), objects found in $want are either
Test::Deep::Cmp objects or not. If they are, they do their special test magic.
If they are not, they are more or less compared to the data in $have without
respect to blessing. For example, a blessed hashref in $want is compared to
the matching data in $have for keys and values.

With my changes, objects in $want are checked for a as_test_deep_cmp method,
which can be called to return a Test::Deep::Cmp to be used instead of the
object. I expect this to be rarely, but sometimes, useful. Issue #50 goes
into the details of why it came up. In that, I mention using this with
JSON::Typist/Test::Deep::JType. I have implemented the described feature at
https://github.com/rjbs/JSON-Typist/pull/2

I'm interested in any thoughts on this before I make a trial release.

--
rjbs
signature.asc

Ricardo Signes

unread,
Dec 27, 2016, 9:00:02 AM12/27/16
to per...@perl.org
* Ricardo Signes <per...@rjbs.manxome.org> [2016-12-18T09:08:23]
> When you call cmp_deeply($have, $want), objects found in $want are either
> Test::Deep::Cmp objects or not. If they are, they do their special test
> magic. If they are not, they are more or less compared to the data in $have
> without respect to blessing. For example, a blessed hashref in $want is
> compared to the matching data in $have for keys and values.

I have trial-released this in Test-Deep-1.125_001.tar.gz

--
rjbs
signature.asc
0 new messages