github.com/inaneverb/ekacore/ekaunsafe/v4@v4.0.0/iface_test.go (about) 1 // Copyright © 2020. All rights reserved. 2 // Author: Ilya Stroy. 3 // Contacts: iyuryevich@pm.me, https://github.com/qioalice 4 // License: https://opensource.org/licenses/MIT 5 6 package ekaunsafe_test 7 8 import ( 9 "testing" 10 11 "github.com/stretchr/testify/assert" 12 13 "github.com/inaneverb/ekacore/ekaunsafe/v4" 14 ) 15 16 func TestUnpackInterface(t *testing.T) { 17 18 type T1 struct{} 19 type T2 struct{} 20 21 var t1 = T1{} 22 var t2 = T2{} 23 24 assert.Equal(t, ekaunsafe.UnpackInterface(&t1).Type, ekaunsafe.UnpackInterface(new(T1)).Type) 25 assert.Equal(t, ekaunsafe.UnpackInterface(&t2).Type, ekaunsafe.UnpackInterface(new(T2)).Type) 26 27 assert.NotEqual(t, ekaunsafe.UnpackInterface(&t1).Type, ekaunsafe.UnpackInterface(new(T2)).Type) 28 assert.NotEqual(t, ekaunsafe.UnpackInterface(&t2).Type, ekaunsafe.UnpackInterface(new(T1)).Type) 29 30 assert.NotEqual(t, ekaunsafe.UnpackInterface(t1).Type, ekaunsafe.UnpackInterface(t2).Type) 31 }