Add StructToStruct
This commit is contained in:
@@ -4,6 +4,28 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestStructToStruct(t *testing.T) {
|
||||
type O struct {
|
||||
Name string
|
||||
Age int
|
||||
Active bool
|
||||
}
|
||||
|
||||
o := &O{
|
||||
Name: "Nick",
|
||||
Age: 15,
|
||||
Active: true,
|
||||
}
|
||||
|
||||
var oo O
|
||||
|
||||
StructToStruct(o, &oo)
|
||||
|
||||
if oo.Name != "Nick" || oo.Age != 15 || !oo.Active {
|
||||
t.Fatalf("failed to copy %v", oo)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStructToMapRecursive(t *testing.T) {
|
||||
type O struct {
|
||||
Name string
|
||||
|
||||
Reference in New Issue
Block a user