@@ -262,6 +262,11 @@ func TestNotSame(t *testing.T) {
262
262
263
263
func Test_samePointers (t * testing.T ) {
264
264
p := ptr (2 )
265
+ c1 , c2 := make (chan int ), make (chan int )
266
+ f1 , f2 := func () {}, func () {}
267
+ m1 , m2 := map [int ]int {1 : 2 }, map [int ]int {1 : 2 }
268
+ p1 , p2 := ptr (3 ), ptr (3 )
269
+ s1 , s2 := []int {4 , 5 }, []int {4 , 5 }
265
270
266
271
type args struct {
267
272
first interface {}
@@ -297,6 +302,56 @@ func Test_samePointers(t *testing.T) {
297
302
args : args {first : [2 ]int {1 , 2 }, second : []int {1 , 2 }},
298
303
assertion : False ,
299
304
},
305
+ {
306
+ name : "chan(1) == chan(1)" ,
307
+ args : args {first : c1 , second : c1 },
308
+ assertion : True ,
309
+ },
310
+ {
311
+ name : "func(1) == func(1)" ,
312
+ args : args {first : f1 , second : f1 },
313
+ assertion : True ,
314
+ },
315
+ {
316
+ name : "map(1) == map(1)" ,
317
+ args : args {first : m1 , second : m1 },
318
+ assertion : True ,
319
+ },
320
+ {
321
+ name : "ptr(1) == ptr(1)" ,
322
+ args : args {first : p1 , second : p1 },
323
+ assertion : True ,
324
+ },
325
+ {
326
+ name : "slice(1) == slice(1)" ,
327
+ args : args {first : s1 , second : s1 },
328
+ assertion : True ,
329
+ },
330
+ {
331
+ name : "chan(1) != chan(2)" ,
332
+ args : args {first : c1 , second : c2 },
333
+ assertion : False ,
334
+ },
335
+ {
336
+ name : "func(1) != func(2)" ,
337
+ args : args {first : f1 , second : f2 },
338
+ assertion : False ,
339
+ },
340
+ {
341
+ name : "map(1) != map(2)" ,
342
+ args : args {first : m1 , second : m2 },
343
+ assertion : False ,
344
+ },
345
+ {
346
+ name : "ptr(1) != ptr(2)" ,
347
+ args : args {first : p1 , second : p2 },
348
+ assertion : False ,
349
+ },
350
+ {
351
+ name : "slice(1) != slice(2)" ,
352
+ args : args {first : s1 , second : s2 },
353
+ assertion : False ,
354
+ },
300
355
}
301
356
for _ , tt := range tests {
302
357
t .Run (tt .name , func (t * testing.T ) {
0 commit comments