SMGeneric using cloning for replication to avoid concurrency

This commit is contained in:
DanB
2016-12-15 12:54:41 +01:00
parent 488346c1ed
commit 49924fc210
3 changed files with 17 additions and 1 deletions

View File

@@ -630,6 +630,15 @@ func TestClone(t *testing.T) {
if b != a {
t.Error("Expected:", a, ", received:", b)
}
// Clone from an interface
c := "mystr"
ifaceC := interface{}(c)
clndIface := reflect.Indirect(reflect.New(reflect.TypeOf(ifaceC))).Interface().(string)
if err := Clone(ifaceC, &clndIface); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(ifaceC, clndIface) {
t.Errorf("Expecting: %+v, received: %+v", ifaceC, clndIface)
}
}
func TestIntPointer(t *testing.T) {