mojolicious / mojo

:sparkles: Mojolicious - Perl real-time web framework
https://mojolicious.org
Artistic License 2.0
2.66k stars 577 forks source link

Test::Mojo->json_is(): misleading output on some test failures #1456

Closed DrHyde closed 3 years ago

DrHyde commented 4 years ago

When testing a JSON value like { "fruit": "lemon" } with ...->json_is('/animal', 'bat') we correctly get a failure, but the diagnostic message complains that undef doesn't equal 'bat' which isn't quite right. The value isn't even undef, it doesn't exist. Same applies to json_like.

jhthorsen commented 4 years ago

How do you suggest this to be fixed @DrHyde?

DrHyde commented 4 years ago

My plan was to factor out the important bit of json_has and reuse that to decide whether to spit out an alternative message.

DrHyde commented 4 years ago

FYI ... work in progress. Still need to muck about with json_like.

jhthorsen commented 4 years ago

The problem with https://github.com/DrHyde/mojo/commit/3417e72b8def8e3da5a0ee80fff83e751d323951#diff-a3cb567ecd4d756d754d1baee62ee931R215 is that it ignores $desc.

DrHyde commented 4 years ago

Hurrah for code review :-)

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

DrHyde commented 3 years ago

This is activity. The issue shouldn't be closed.

kraih commented 3 years ago

I do not appreciate attempts to cheat the system. So i'm closing this issue right away. If you're still working on a patch you should have said so.

DrHyde commented 3 years ago

No, I'm not working on a patch. The PR was rejected because it only solved part of the problem, not the entire problem. The problem still exists, however, which is why the issue should not have been closed. My apologies if you misunderstood my attempt at communicating with the bot.