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

Report errors properly in EventuallyWithT #1438

Closed
wants to merge 4 commits into from

Conversation

cszczepaniak
Copy link

@cszczepaniak cszczepaniak commented Jul 30, 2023

Summary

EventuallyWithT can incorrectly report no errors.

Changes

Keep track of the last errors in EventuallyWithT to use them for reporting.

Motivation

Running TestEventuallyWithTFalse as changed in this PR against master will fail a shown below. This PR fixes the bug.

=== RUN   TestEventuallyWithTFalse
    /testify/assert/assertions_test.go:2776:
        	Error Trace:
        	Error:      	"[
        	            		Error Trace:
        	            		Error:      	Condition never satisfied
        	            	]" should have 2 item(s), but has 1
        	Test:       	TestEventuallyWithTFalse
--- FAIL: TestEventuallyWithTFalse (0.10s)
FAIL
FAIL	github.com/stretchr/testify/assert	0.104s

Related issues

Closes #1437

@cszczepaniak
Copy link
Author

#1395 is a duplicate, so I'm closing this. However, that PR might benefit from a test similar to the one in this PR that explicitly exposes the problem.

@dolmen
Copy link
Collaborator

dolmen commented Jul 30, 2023

@cszczepaniak Please post your suggestions on #1395.

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

Successfully merging this pull request may close these issues.

EventuallyWithT does not always copy the last errors
2 participants