1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-11-23 21:44:44 +02:00

Use assert for test (#3201)

instead of `if`s
This commit is contained in:
qwerty287
2024-01-14 19:33:58 +01:00
committed by GitHub
parent b9f6f3f9fb
commit 001b5639a6
34 changed files with 417 additions and 1140 deletions

View File

@@ -16,6 +16,8 @@ package pipeline
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestExitError(t *testing.T) {
@@ -23,18 +25,12 @@ func TestExitError(t *testing.T) {
UUID: "14534321",
Code: 255,
}
got, want := err.Error(), "uuid=14534321: exit code 255"
if got != want {
t.Errorf("Want error message %q, got %q", want, got)
}
assert.Equal(t, "uuid=14534321: exit code 255", err.Error())
}
func TestOomError(t *testing.T) {
err := OomError{
UUID: "14534321",
}
got, want := err.Error(), "uuid=14534321: received oom kill"
if got != want {
t.Errorf("Want error message %q, got %q", want, got)
}
assert.Equal(t, "uuid=14534321: received oom kill", err.Error())
}