Skip to content

Commit 2537216

Browse files
committed
hash/maphash: more testcases for maphash.Comparable
This commit extends test suite for maphash.Comparable in order to have at least some instances of pointer types.
1 parent 1ee053e commit 2537216

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/hash/maphash/maphash_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,17 @@ func TestComparable(t *testing.T) {
254254
}
255255
testComparable(t, s1, s2)
256256
testComparable(t, s1.s, s2.s)
257+
c1 := make(chan struct{})
258+
c2 := make(chan struct{})
259+
testComparable(t, c1, c1)
260+
testComparable(t, chan struct{}(nil))
257261
testComparable(t, float32(0), negativeZero[float32]())
258262
testComparable(t, float64(0), negativeZero[float64]())
259263
testComparableNoEqual(t, math.NaN(), math.NaN())
260264
testComparableNoEqual(t, [2]string{"a", ""}, [2]string{"", "a"})
261265
testComparableNoEqual(t, struct{ a, b string }{"foo", ""}, struct{ a, b string }{"", "foo"})
262266
testComparableNoEqual(t, struct{ a, b any }{int(0), struct{}{}}, struct{ a, b any }{struct{}{}, int(0)})
267+
testComparableNoEqual(t, c1, c2)
263268
}
264269

265270
func testComparableNoEqual[T comparable](t *testing.T, v1, v2 T) {

0 commit comments

Comments
 (0)