1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-12 16:52:29 +08:00

fix: fix issue #169

This commit is contained in:
dudaodong
2024-02-20 17:29:32 +08:00
parent c88fd3db86
commit 3a71a8697d
3 changed files with 25 additions and 13 deletions

View File

@@ -8,10 +8,10 @@ import (
type (
Person struct {
Name string `json:"name"`
Age int `json:"age"`
Phone string `json:"phone"`
Address Address `json:"address"`
Name string `json:"name"`
Age int `json:"age"`
Phone string `json:"phone"`
Address *Address `json:"address"`
}
Address struct {
@@ -38,6 +38,7 @@ func TestStructType(t *testing.T) {
var p Person
err := MapTo(src, &p)
assert.IsNil(err)
assert.Equal(src["name"], p.Name)
assert.Equal(src["age"], p.Age)
assert.Equal(src["phone"], p.Phone)