github.com/qioalice/ekago/v3@v3.3.2-0.20221202205325-5c262d586ee4/internal/ekaclike/go_interface_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 ekaclike_test 7 8 import ( 9 "testing" 10 11 "github.com/qioalice/ekago/v3/internal/ekaclike" 12 13 "github.com/stretchr/testify/assert" 14 ) 15 16 func TestUnpackInterface(t *testing.T) { 17 18 type T1 struct{} 19 type T2 struct{} 20 21 t1 := T1{} 22 t2 := T2{} 23 24 assert.Equal(t, ekaclike.UnpackInterface(&t1).Type, ekaclike.UnpackInterface(new(T1)).Type) 25 assert.Equal(t, ekaclike.UnpackInterface(&t2).Type, ekaclike.UnpackInterface(new(T2)).Type) 26 27 assert.NotEqual(t, ekaclike.UnpackInterface(&t1).Type, ekaclike.UnpackInterface(new(T2)).Type) 28 assert.NotEqual(t, ekaclike.UnpackInterface(&t2).Type, ekaclike.UnpackInterface(new(T1)).Type) 29 30 assert.NotEqual(t, ekaclike.UnpackInterface(t1).Type, ekaclike.UnpackInterface(t2).Type) 31 }