| 1234567891011121314151617181920212223242526272829303132333435 | package parserimport (	"testing")func TestStruct2Map(t *testing.T) {	type Base struct {		A int `json:"a"`	}	type p struct {		Base		B int `json:"b"`	}	d := p{		Base: Base{			A: 1,		},		B: 2,	}	result := StructToMap(d)	if result["a"] != 1 {		t.Error("a should be 1")	}	if result["b"] != 2 {		t.Error("b should be 2")	}}
 |