1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 08:32:40 +08:00
This commit is contained in:
2022-05-13 14:19:44 +08:00
parent 25e8c8c58b
commit d4d68dc263
5 changed files with 48 additions and 4 deletions

View File

@ -5,7 +5,7 @@ import (
"testing"
"github.com/charlienet/go-mixed/structs"
"github.com/go-playground/assert/v2"
"github.com/stretchr/testify/assert"
)
func TestNew(t *testing.T) {
@ -19,3 +19,22 @@ func TestNew(t *testing.T) {
t.Log(s.Names())
t.Log(s.Values())
}
func TestIsZero(t *testing.T) {
var v1 int
assert.True(t, structs.IsZero(v1))
var v2 = struct {
Msg string
}{}
assert.True(t, structs.IsZero(v2))
var v3 = struct {
VV int
Msg string
}{Msg: "abc"}
assert.False(t, structs.IsZero(v3))
v3.Msg = ""
assert.True(t, structs.IsZero(v3))
}