Skip to content

http_assertions: honour the msgAndArgs provided with each assertion #1548

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

Merged
merged 4 commits into from
Feb 23, 2024

Conversation

arjunmahishi
Copy link
Collaborator

@arjunmahishi arjunmahishi commented Feb 22, 2024

Summary

The http assertions do not use the msgAndArgs at all. This commit fixes that.

Related issues

Not directly related, but stemmed from looking into #316

Closes #1324

brackendawson
brackendawson previously approved these changes Feb 23, 2024
Copy link
Collaborator

@brackendawson brackendawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, and I don't think you've missed any.

Do you think there is any unit testing that could be done here to avoid regressions? Very difficult because each assertion may have many different calls to Fail.

@arjunmahishi
Copy link
Collaborator Author

I think the existing tests are good enough to prove that there is no regression. None of them are passing the custom message. That ensures backward compatibility.

Actually, let me add a message in some of the existing tests, just for the sake of it.

A mix of using and not using msgAndArgs will ensure that there is no
regression.
This commit also adds the method `Failed() bool` to the mockTestingT
struct. This is usefull for asserting failure in tests
@brackendawson brackendawson merged commit e2741fa into stretchr:master Feb 23, 2024
@arjunmahishi arjunmahishi deleted the msgAndArgs branch February 23, 2024 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InEpsilonSlice doesn't append custom error message
2 participants