Skip to content

Commit 663efed

Browse files
committed
Correct argument order in test assertions
The `testify` Go packages use the "Yoda condition"-style argument order: expected, actual. If the assertions reverse the order of the arguments, the test failure output becomes very confusing. Even though `assert.ElementsMatch()` doesn't treat the order of the arguments specially, it is best to be consistent with the order.
1 parent 86cc80c commit 663efed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ index cff484d..9f67763 100644
103103
assert.Equal(t, "submission", requestType, testName)
104104
assert.Equal(t, "", requestError, testName)
105105
assert.Equal(t, "submit", arduinoLintLibraryManagerSetting, testName)
106-
assert.ElementsMatch(t, submissionURLs, []string{"https://github.com/foo/bar", "https://github.com/foo/baz"}, testName)
106+
assert.ElementsMatch(t, []string{"https://github.com/foo/bar", "https://github.com/foo/baz"}, submissionURLs, testName)
107107

108108
testName = "Submission w/ no newline at end of file"
109109
diff = []byte(`
@@ -137,7 +137,7 @@ index cff484d..1b0b80b 100644
137137
assert.Equal(t, "submission", requestType, testName)
138138
assert.Equal(t, "", requestError, testName)
139139
assert.Equal(t, "submit", arduinoLintLibraryManagerSetting, testName)
140-
assert.ElementsMatch(t, submissionURLs, []string{"https://github.com/foo/bar"}, testName)
140+
assert.ElementsMatch(t, []string{"https://github.com/foo/bar"}, submissionURLs, testName)
141141

142142
testName = "Removal"
143143
diff = []byte(`
@@ -170,7 +170,7 @@ index cff484d..8b401a1 100644
170170
assert.Equal(t, "modification", requestType, testName)
171171
assert.Equal(t, "", requestError, testName)
172172
assert.Equal(t, "update", arduinoLintLibraryManagerSetting, testName)
173-
assert.Equal(t, submissionURLs, []string{"https://github.com/foo/bar"}, testName)
173+
assert.Equal(t, []string{"https://github.com/foo/bar"}, submissionURLs, testName)
174174
}
175175

176176
func Test_normalizeURL(t *testing.T) {

0 commit comments

Comments
 (0)