mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-23 13:52:26 +08:00
fix:convertor struct to map by struct ptr (#221)
Co-authored-by: emrysechobygo <emrysechobygo@hotmail.com>
This commit is contained in:
@@ -156,13 +156,17 @@ func TestStructToMap(t *testing.T) {
|
||||
Name string `json:"name"`
|
||||
age int
|
||||
}
|
||||
p := People{
|
||||
p := &People{
|
||||
"test",
|
||||
100,
|
||||
}
|
||||
pm, _ := StructToMap(p)
|
||||
var expected = map[string]interface{}{"name": "test"}
|
||||
data, _ := StructToMap(p)
|
||||
var expected = map[string]interface{}{
|
||||
"name": "test",
|
||||
}
|
||||
assert.Equal(expected, pm)
|
||||
assert.Equal(expected, data)
|
||||
}
|
||||
|
||||
func TestColorHexToRGB(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user