utils_test.go 421 字节
package utils

import "testing"

func Test_DeepCopy(t *testing.T) {
	type User1 struct {
		Name    string
		Age     int
		Address string
	}
	type User2 struct {
		Name string
		Age  int
		Job  string
	}
	var src = User1{Name: "foo", Age: 10, Address: "bar"}
	var dst *User2
	if err := DeepCopy(&dst, src); err != nil {
		t.Fatal(err)
	}
	if src.Name != dst.Name {
		t.Fatal("deep copy fail.")
	}
	//t.Log(src,"\n",dst)
}