MCPcopy Index your code
hub / github.com/tailscale/tailscale / TestGMapSet

Function TestGMapSet

types/lazy/map_test.go:53–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestGMapSet(t *testing.T) {
54 var gm GMap[string, int]
55 if !gm.Set("42", 42) {
56 t.Fatalf("Set failed")
57 }
58 if gm.Set("42", 43) {
59 t.Fatalf("Set succeeded after first Set")
60 }
61 n := int(testing.AllocsPerRun(1000, func() {
62 got := gm.Get("42", fortyTwo)
63 if got != 42 {
64 t.Fatalf("got %v; want 42", got)
65 }
66 }))
67 if n != 0 {
68 t.Errorf("allocs = %v; want 0", n)
69 }
70}
71
72func TestGMapMustSet(t *testing.T) {
73 var gm GMap[string, int]

Callers

nothing calls this directly

Calls 4

SetMethod · 0.65
FatalfMethod · 0.65
GetMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…