use testify tool
go get -v github.com/stretchr/testify/assert
package car
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestNewWithAssert(t *testing.T) {
c, err := New("", 100)
assert.NotNil(t, err)
assert.Error(t, err)
assert.Nil(t, c)
}
只單獨測試func
go test -v -run={func name}