Change order of "yoda conditions" (1 != foo) (#4756)
staticcheck cleanup: https://staticcheck.io/docs/checks#ST1017
This commit is contained in:
parent
cdb0bddbd8
commit
8d99ada705
|
|
@ -31,7 +31,7 @@ func TestLogCode(t *testing.T) {
|
|||
}
|
||||
th.ServeHTTP(httptest.NewRecorder(), req)
|
||||
expected := `INFO: GET /endpoint 0 201 0 0.0.0.0 JSON={}`
|
||||
if 1 != len(mockLog.GetAllMatching(expected)) {
|
||||
if len(mockLog.GetAllMatching(expected)) != 1 {
|
||||
t.Errorf("Expected exactly one log line matching %q. Got \n%s",
|
||||
expected, strings.Join(mockLog.GetAllMatching(".*"), "\n"))
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ func TestStatusCodeLogging(t *testing.T) {
|
|||
}
|
||||
th.ServeHTTP(httptest.NewRecorder(), req)
|
||||
expected := `INFO: GET /endpoint 0 200 0 0.0.0.0 JSON={}`
|
||||
if 1 != len(mockLog.GetAllMatching(expected)) {
|
||||
if len(mockLog.GetAllMatching(expected)) != 1 {
|
||||
t.Errorf("Expected exactly one log line matching %q. Got \n%s",
|
||||
expected, strings.Join(mockLog.GetAllMatching(".*"), "\n"))
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ func TestOrigin(t *testing.T) {
|
|||
req.Header.Add("Origin", "https://example.com")
|
||||
th.ServeHTTP(httptest.NewRecorder(), req)
|
||||
expected := `INFO: GET /endpoint 0 201 0 0.0.0.0 JSON={.*"Origin":"https://example.com"}`
|
||||
if 1 != len(mockLog.GetAllMatching(expected)) {
|
||||
if len(mockLog.GetAllMatching(expected)) != 1 {
|
||||
t.Errorf("Expected exactly one log line matching %q. Got \n%s",
|
||||
expected, strings.Join(mockLog.GetAllMatching(".*"), "\n"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue