diff options
author | Am Laher <amir.laher@tixtrack.com> | 2022-06-11 21:51:04 +1200 |
---|---|---|
committer | Am Laher <amir.laher@tixtrack.com> | 2022-06-11 21:51:04 +1200 |
commit | 3bd1361378dc30dd2329baabc0b587401c7d43ce (patch) | |
tree | e6b9e67f4996ea32160905ac9dd5ffaadc7d1ce1 /immutable_test.go | |
parent | undo v2 module change after comment from @benbjohnson (diff) | |
download | pds-3bd1361378dc30dd2329baabc0b587401c7d43ce.tar.gz pds-3bd1361378dc30dd2329baabc0b587401c7d43ce.tar.xz |
add missing ptr types; tidyup
Diffstat (limited to 'immutable_test.go')
-rw-r--r-- | immutable_test.go | 72 |
1 files changed, 11 insertions, 61 deletions
diff --git a/immutable_test.go b/immutable_test.go index b11b13f..c4b0297 100644 --- a/immutable_test.go +++ b/immutable_test.go @@ -988,37 +988,6 @@ func TestMap_Set(t *testing.T) { t.Fatalf("expected no value: <%v,%v>", v, ok) } }) - /* - t.Run("ByteSliceKeys", func(t *testing.T) { - m := NewMap[[]byte, string](nil) - m = m.Set([]byte("foo"), "bar") - m = m.Set([]byte("baz"), "bat") - m = m.Set([]byte(""), "EMPTY") - if v, ok := m.Get([]byte("foo")); !ok || v != "bar" { - t.Fatalf("unexpected value: <%v,%v>", v, ok) - } else if v, ok := m.Get([]byte("baz")); !ok || v != "bat" { - t.Fatalf("unexpected value: <%v,%v>", v, ok) - } else if v, ok := m.Get([]byte("")); !ok || v != "EMPTY" { - t.Fatalf("unexpected value: <%v,%v>", v, ok) - } - if v, ok := m.Get([]byte("no_such_key")); ok { - t.Fatalf("expected no value: <%v,%v>", v, ok) - } - }) - - t.Run("NoDefaultHasher", func(t *testing.T) { - type T struct{} - var r string - func() { - defer func() { r = recover().(string) }() - m := NewMap[T, string](nil) - m = m.Set(T{}, "bar") - }() - if r != `immutable.NewHasher: must set hasher for immutable.T type` { - t.Fatalf("unexpected panic: %q", r) - } - }) - */ RunRandom(t, "Random", func(t *testing.T, rand *rand.Rand) { m := NewTestMap() @@ -1813,36 +1782,17 @@ func TestSortedMap_Set(t *testing.T) { } }) - /* - t.Run("ByteSliceKeys", func(t *testing.T) { - m := NewSortedMap[int, int](nil) - m = m.Set([]byte("foo"), "bar") - m = m.Set([]byte("baz"), "bat") - m = m.Set([]byte(""), "EMPTY") - if v, ok := m.Get([]byte("foo")); !ok || v != "bar" { - t.Fatalf("unexpected value: <%v,%v>", v, ok) - } else if v, ok := m.Get([]byte("baz")); !ok || v != "bat" { - t.Fatalf("unexpected value: <%v,%v>", v, ok) - } else if v, ok := m.Get([]byte("")); !ok || v != "EMPTY" { - t.Fatalf("unexpected value: <%v,%v>", v, ok) - } - if v, ok := m.Get([]byte("no_such_key")); ok { - t.Fatalf("expected no value: <%v,%v>", v, ok) - } - }) - - t.Run("NoDefaultComparer", func(t *testing.T) { - var r string - func() { - defer func() { r = recover().(string) }() - m := NewSortedMap[int, int](nil) - m = m.Set(float64(100), "bar") - }() - if r != `immutable.NewComparer: must set comparer for float64 type` { - t.Fatalf("unexpected panic: %q", r) - } - }) - */ + t.Run("NoDefaultComparer", func(t *testing.T) { + var r string + func() { + defer func() { r = recover().(string) }() + m := NewSortedMap[float64, string](nil) + m = m.Set(float64(100), "bar") + }() + if r != `immutable.NewComparer: must set comparer for float64 type` { + t.Fatalf("unexpected panic: %q", r) + } + }) RunRandom(t, "Random", func(t *testing.T, rand *rand.Rand) { m := NewTSortedMap() |