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

Function TestGValueSet

types/lazy/unsync_test.go:55–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestGValueSet(t *testing.T) {
56 var lt GValue[int]
57 if !lt.Set(42) {
58 t.Fatalf("Set failed")
59 }
60 if lt.Set(43) {
61 t.Fatalf("Set succeeded after first Set")
62 }
63 n := int(testing.AllocsPerRun(1000, func() {
64 got := lt.Get(fortyTwo)
65 if got != 42 {
66 t.Fatalf("got %v; want 42", got)
67 }
68 }))
69 if n != 0 {
70 t.Errorf("allocs = %v; want 0", n)
71 }
72}
73
74func TestGValueMustSet(t *testing.T) {
75 var lt GValue[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…