From 94519b7c7fcca2aa5e6cf1dc184a28d83bd4e2f4 Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Wed, 2 Dec 2020 12:20:23 -0500 Subject: [PATCH] compare the correct slices in the tests --- deepcopy_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deepcopy_test.go b/deepcopy_test.go index f150b1a..deb6dc7 100644 --- a/deepcopy_test.go +++ b/deepcopy_test.go @@ -29,7 +29,7 @@ func TestSimple(t *testing.T) { CopyBools: Bools := []bool{true, true, false, false} cpyB := Copy(Bools).([]bool) - if (*reflect.SliceHeader)(unsafe.Pointer(&Strings)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyB)).Data { + if (*reflect.SliceHeader)(unsafe.Pointer(&Bools)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyB)).Data { t.Error("[]bool: expected SliceHeader data pointers to point to different locations, they didn't") goto CopyBytes } @@ -46,7 +46,7 @@ CopyBools: CopyBytes: Bytes := []byte("hello") cpyBt := Copy(Bytes).([]byte) - if (*reflect.SliceHeader)(unsafe.Pointer(&Strings)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyBt)).Data { + if (*reflect.SliceHeader)(unsafe.Pointer(&Bytes)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyBt)).Data { t.Error("[]byte: expected SliceHeader data pointers to point to different locations, they didn't") goto CopyInts } @@ -63,7 +63,7 @@ CopyBytes: CopyInts: Ints := []int{42} cpyI := Copy(Ints).([]int) - if (*reflect.SliceHeader)(unsafe.Pointer(&Strings)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyI)).Data { + if (*reflect.SliceHeader)(unsafe.Pointer(&Ints)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyI)).Data { t.Error("[]int: expected SliceHeader data pointers to point to different locations, they didn't") goto CopyUints } @@ -80,7 +80,7 @@ CopyInts: CopyUints: Uints := []uint{1, 2, 3, 4, 5} cpyU := Copy(Uints).([]uint) - if (*reflect.SliceHeader)(unsafe.Pointer(&Strings)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyU)).Data { + if (*reflect.SliceHeader)(unsafe.Pointer(&Uints)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyU)).Data { t.Error("[]: expected SliceHeader data pointers to point to different locations, they didn't") goto CopyFloat32s } @@ -97,7 +97,7 @@ CopyUints: CopyFloat32s: Float32s := []float32{3.14} cpyF := Copy(Float32s).([]float32) - if (*reflect.SliceHeader)(unsafe.Pointer(&Strings)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyF)).Data { + if (*reflect.SliceHeader)(unsafe.Pointer(&Float32s)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyF)).Data { t.Error("[]float32: expected SliceHeader data pointers to point to different locations, they didn't") goto CopyInterfaces } @@ -114,7 +114,7 @@ CopyFloat32s: CopyInterfaces: Interfaces := []interface{}{"a", 42, true, 4.32} cpyIf := Copy(Interfaces).([]interface{}) - if (*reflect.SliceHeader)(unsafe.Pointer(&Strings)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyIf)).Data { + if (*reflect.SliceHeader)(unsafe.Pointer(&Interfaces)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyIf)).Data { t.Error("[]interfaces: expected SliceHeader data pointers to point to different locations, they didn't") return }