Skip to content

Commit

Permalink
remove NotEmpty (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktong authored Nov 13, 2023
1 parent 1147575 commit e4eb38c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
13 changes: 4 additions & 9 deletions internal/assert/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ func NoError(tb testing.TB, err error) {
func EqualError(tb testing.TB, err error, message string) {
tb.Helper()

if err.Error() != message {
switch {
case err == nil:
tb.Errorf("expected: %v; actual: <nil>", message)
case err.Error() != message:
tb.Errorf("expected: %v; actual: %v", message, err.Error())
}
}
Expand All @@ -39,11 +42,3 @@ func True(tb testing.TB, value bool) {
tb.Errorf("expected True")
}
}

func NotEmpty(tb testing.TB, value any) {
tb.Helper()

if reflect.ValueOf(value).IsZero() {
tb.Errorf("expected not empty")
}
}
4 changes: 2 additions & 2 deletions provider/env/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func BenchmarkNew(b *testing.B) {

values, err := loader.Load()
assert.NoError(b, err)
assert.NotEmpty(b, values["USER"])
assert.True(b, values["USER"] != "")
}

func BenchmarkLoad(b *testing.B) {
Expand All @@ -36,5 +36,5 @@ func BenchmarkLoad(b *testing.B) {
b.StopTimer()

assert.NoError(b, err)
assert.NotEmpty(b, values["USER"])
assert.True(b, values["USER"] != "")
}

0 comments on commit e4eb38c

Please sign in to comment.