✅ Add testify for simpler tests
This commit is contained in:
parent
0aa0ac284e
commit
739bed214c
3 changed files with 11 additions and 8 deletions
|
|
@ -2,13 +2,13 @@ package utils
|
|||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestTern(t *testing.T) {
|
||||
out := Tern(true, 5, 2)
|
||||
if out != 5 {
|
||||
t.Fatalf(`Tern(%v, %d, %d) = %v, want %d`, true, 5, 2, out, 5)
|
||||
}
|
||||
assert.Equal(t, Tern(true, 5, 2), 5)
|
||||
assert.Equal(t, Tern(false, 5, 2), 2)
|
||||
}
|
||||
|
||||
func TestTernCall(t *testing.T) {
|
||||
|
|
@ -18,8 +18,6 @@ func TestTernCall(t *testing.T) {
|
|||
two := func() int {
|
||||
return 2
|
||||
}
|
||||
out := TernCall(true, five, two)
|
||||
if out != 5 {
|
||||
t.Fatalf(`TernCall(%v, func () { return 5}, func () {return 2}) = %v, want %d`, true, out, 5)
|
||||
}
|
||||
assert.Equal(t, TernCall(true, five, two), 5)
|
||||
assert.Equal(t, TernCall(false, five, two), 2)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue