Skip to content

Commit

Permalink
Merge pull request etcd-io#17675 from callthingsoff/simplify_testutil…
Browse files Browse the repository at this point in the history
…_assert

client/pkg/testutil: eliminate copyToInterface function
  • Loading branch information
serathius committed Apr 2, 2024
2 parents b680e24 + 229ceb3 commit f611da6
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions client/pkg/testutil/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ import (
"github.com/stretchr/testify/assert"
)

func copyToInterface(msg ...string) []any {
newMsg := make([]any, len(msg))
for i, v := range msg {
newMsg[i] = v
}
return newMsg
}

func AssertNil(t *testing.T, v any) {
t.Helper()
assert.Nil(t, v)
Expand All @@ -42,12 +34,10 @@ func AssertNotNil(t *testing.T, v any) {

func AssertTrue(t *testing.T, v bool, msg ...string) {
t.Helper()
newMsg := copyToInterface(msg...)
assert.Equal(t, true, v, newMsg)
assert.Equal(t, true, v, msg)
}

func AssertFalse(t *testing.T, v bool, msg ...string) {
t.Helper()
newMsg := copyToInterface(msg...)
assert.Equal(t, false, v, newMsg)
assert.Equal(t, false, v, msg)
}

0 comments on commit f611da6

Please sign in to comment.