New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is-deeply not using custom eqv operators #5889
Comments
From tim.bollman@live.comThe is-deeply operator does not appear to pick up custom infix eqv variants. I can see on line 567 of rakudo/lib/Test.pm6 that _is_deeply is using infix:<eqv>, but it doesn't pick up the custom variant. I attempted exporting the operator and moving the use Test below the multi declaration, but it didn't make any difference (I didn't expect it to, but didn't hurt to try). use v6; class Custom-Equality { # Define a custom equivalence operator that equates the opposite properties my Custom-Equality $x .= new(:a<cat>, :b<dog>); ok($x eqv $y, 'x is equivalent to y'); # Passes |
From @zoffixznetOn Fri, 16 Dec 2016 12:40:05 -0800, TimTom wrote:
Thank you for the report. However, this is not a bug. What is-deeply uses under the hood is secret and you should not be As for the reason why it doesn't work, it's because your infix:<eqv> routine is [1] Raku/doc@f705a6f Cheers, |
The RT System itself - Status changed from 'new' to 'open' |
@zoffixznet - Status changed from 'open' to 'rejected' |
From @zoffixznetForgot to mention... Check out `cmp-ok` routine for your task: https://docs.perl6.org/language/testing#index-entry-cmp-ok-cmp-ok%28%24value%2C_%24comparison%2C_%24expected%2C_%24description%3F%29 cmp-ok $got, 'eqv', $expected should pick up your custom operator. |
From tim.bollman@live.comI definitely went down that road because of the documentation (needed to compare type graphs with loops and I knew I could build a specialization of eqv). I'm not sure the change is strong enough to really dissuade that line of thinking, but it's at least better than it was so thanks. I would personally remove the reference to eqv entirely and put something like: | Marks a test as passed if C<$value> and C<$expected> are the same using Personally multi candidates feel like something that should be dynamic scope, but I understand the trade-off against action at a distance. On Fri, 16 Dec 2016 17:52:33 -0800, cpan@zoffix.com wrote:
|
Migrated from rt.perl.org#130362 (status was 'rejected')
Searchable as RT130362$
The text was updated successfully, but these errors were encountered: