The Wayback Machine - http://web.archive.org/web/20200624073524/https://github.com/mojolicious/mojo/issues/1456
Skip to content
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

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

Open
DrHyde opened this issue Jan 10, 2020 · 5 comments
Open

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

DrHyde opened this issue Jan 10, 2020 · 5 comments

Comments

@DrHyde
Copy link

@DrHyde DrHyde commented Jan 10, 2020

  • Mojolicious version: 8.29
  • Perl version: 5.26.1
  • Operating system: High Sierra

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
Copy link
Member

@jhthorsen jhthorsen commented Jan 12, 2020

How do you suggest this to be fixed @DrHyde?

@DrHyde
Copy link
Author

@DrHyde DrHyde commented Jan 13, 2020

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
Copy link
Author

@DrHyde DrHyde commented Jan 14, 2020

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

@jhthorsen
Copy link
Member

@jhthorsen jhthorsen commented Jan 14, 2020

The problem with DrHyde@3417e72#diff-a3cb567ecd4d756d754d1baee62ee931R215 is that it ignores $desc.

@DrHyde
Copy link
Author

@DrHyde DrHyde commented Jan 14, 2020

Hurrah for code review :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.