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

fix: wrong usage of testify Equal() function #1379

Merged
merged 2 commits into from
Dec 7, 2022

Conversation

mnagaa
Copy link
Contributor

@mnagaa mnagaa commented Nov 20, 2022

Summary

This PR fixes the wrong usages of testify package.

Function arguments of Equal() from the testify package should be first expected and second actual values. The actual values are often the function's return to be tested. However, many tests with Equal() in this repo are incorrect.

The definition is as follows:

func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
	if h, ok := a.t.(tHelper); ok {
		h.Helper()
	}
	Equal(a.t, expected, actual, msgAndArgs...)
}

https://pkg.go.dev/github.com/stretchr/testify/require#Assertions.Equal

This leads to showing the unexpected verbose output when the test fails.

@mnagaa mnagaa force-pushed the fix-testify-equal-args branch from d629796 to e06ea2f Compare November 20, 2022 19:37
@sfc-gh-swinkler sfc-gh-swinkler merged commit 476b330 into Snowflake-Labs:main Dec 7, 2022
@sfc-gh-swinkler
Copy link
Collaborator

@mnagaa thank you!

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.

2 participants