1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
package example
import (
"github.com/alecthomas/assert"
"github.com/stretchr/testify/require"
"testing"
)
type Person struct {
Name string
Age int
}
func TestDiff(t *testing.T) {
expected := []*Person{{"Alec", 20}, {"Bob", 21}, {"Sally", 22}}
actual := []*Person{{"Alex", 20}, {"Bob", 22}, {"Sally", 22}}
assert.Equal(t, expected, actual)
}
func TestStretchrDiff(t *testing.T) {
expected := []*Person{{"Alec", 20}, {"Bob", 21}, {"Sally", 22}}
actual := []*Person{{"Alex", 20}, {"Bob", 22}, {"Sally", 22}}
require.Equal(t, expected, actual)
}
|