diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-06-22 18:36:55 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-06-26 08:11:10 +0200 |
commit | 8932d1739341cb97b9a0d2486f0492472201170a (patch) | |
tree | 8ddeaab09ca1c102dc8be1e6254d495a62c87561 /pkg/utils | |
parent | de69fbd6450178ae64d80180efa64a3bed6489e6 (diff) |
Cleanup: remove unnecessary if statements
The assert package is already very good at displaying errors, including printing
a diff of expected and actual value, so there's no point in printing the same
information again ourselves.
Diffstat (limited to 'pkg/utils')
-rw-r--r-- | pkg/utils/formatting_test.go | 8 | ||||
-rw-r--r-- | pkg/utils/rebase_todo_test.go | 12 |
2 files changed, 5 insertions, 15 deletions
diff --git a/pkg/utils/formatting_test.go b/pkg/utils/formatting_test.go index 27c1d172c..2de282311 100644 --- a/pkg/utils/formatting_test.go +++ b/pkg/utils/formatting_test.go @@ -79,9 +79,7 @@ func TestGetPadWidths(t *testing.T) { for _, test := range tests { output := getPadWidths(test.input) - if !assert.EqualValues(t, output, test.expected) { - t.Errorf("getPadWidths(%v) = %v, want %v", test.input, output, test.expected) - } + assert.EqualValues(t, output, test.expected) } } @@ -219,8 +217,6 @@ func TestRenderDisplayStrings(t *testing.T) { for _, test := range tests { output := RenderDisplayStrings(test.input, test.columnAlignments) - if !assert.EqualValues(t, output, test.expected) { - t.Errorf("RenderDisplayStrings(%v) = %v, want %v", test.input, output, test.expected) - } + assert.EqualValues(t, output, test.expected) } } diff --git a/pkg/utils/rebase_todo_test.go b/pkg/utils/rebase_todo_test.go index 4f554e926..a9bcb574b 100644 --- a/pkg/utils/rebase_todo_test.go +++ b/pkg/utils/rebase_todo_test.go @@ -321,18 +321,12 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) { actualTodos, actualErr := moveFixupCommitDown(scenario.todos, scenario.originalSha, scenario.fixupSha) if scenario.expectedErr == nil { - if !assert.NoError(t, actualErr) { - t.Errorf("Expected no error, got: %v", actualErr) - } + assert.NoError(t, actualErr) } else { - if !assert.EqualError(t, actualErr, scenario.expectedErr.Error()) { - t.Errorf("Expected err: %v, got: %v", scenario.expectedErr, actualErr) - } + assert.EqualError(t, actualErr, scenario.expectedErr.Error()) } - if !assert.EqualValues(t, actualTodos, scenario.expectedTodos) { - t.Errorf("Expected todos: %v, got: %v", scenario.expectedTodos, actualTodos) - } + assert.EqualValues(t, actualTodos, scenario.expectedTodos) }) } } |