Commit 9592df4a authored by Frederick Akalin's avatar Frederick Akalin

Add assertion in TestHandleMapLookupCount

parent 3dce6f5d
...@@ -21,13 +21,17 @@ func TestHandleMapLookupCount(t *testing.T) { ...@@ -21,13 +21,17 @@ func TestHandleMapLookupCount(t *testing.T) {
t.Log("portable:", portable) t.Log("portable:", portable)
v := new(handled) v := new(handled)
hm := newPortableHandleMap() hm := newPortableHandleMap()
h1, _ := hm.Register(v) h1, g1 := hm.Register(v)
h2, _ := hm.Register(v) h2, g2 := hm.Register(v)
if h1 != h2 { if h1 != h2 {
t.Fatalf("double register should reuse handle: got %d want %d.", h2, h1) t.Fatalf("double register should reuse handle: got %d want %d.", h2, h1)
} }
if g1 != g2 {
t.Fatalf("double register should reuse generation: got %d want %d.", g2, g1)
}
hm.Register(v) hm.Register(v)
forgotten, obj := hm.Forget(h1, 1) forgotten, obj := hm.Forget(h1, 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment