Skip to content

Report errors properly in EventuallyWithT#1438

Closed
cszczepaniak wants to merge 4 commits into
stretchr:masterfrom
cszczepaniak:cs/fix_1437
Closed

Report errors properly in EventuallyWithT#1438
cszczepaniak wants to merge 4 commits into
stretchr:masterfrom
cszczepaniak:cs/fix_1437

Conversation

@cszczepaniak
Copy link
Copy Markdown
Contributor

@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

Comment thread assert/assertions.go
@cszczepaniak
Copy link
Copy Markdown
Contributor 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
Copy Markdown
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