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

Function TestSyncValueSetForTest

types/lazy/sync_test.go:152–356  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

150}
151
152func TestSyncValueSetForTest(t *testing.T) {
153 testErr := errors.New("boom")
154 tests := []struct {
155 name string
156 initValue opt.Value[int]
157 initErr opt.Value[error]
158 setForTestValue int
159 setForTestErr error
160 getValue int
161 getErr opt.Value[error]
162 wantValue int
163 wantErr error
164 routines int
165 }{
166 {
167 name: "GetOk",
168 setForTestValue: 42,
169 getValue: 8,
170 wantValue: 42,
171 },
172 {
173 name: "GetOk/WithInit",
174 initValue: opt.ValueOf(4),
175 setForTestValue: 42,
176 getValue: 8,
177 wantValue: 42,
178 },
179 {
180 name: "GetOk/WithInitErr",
181 initValue: opt.ValueOf(4),
182 initErr: opt.ValueOf(errors.New("blast")),
183 setForTestValue: 42,
184 getValue: 8,
185 wantValue: 42,
186 },
187 {
188 name: "GetErr",
189 setForTestValue: 42,
190 setForTestErr: testErr,
191 getValue: 8,
192 getErr: opt.ValueOf(errors.New("ka-boom")),
193 wantValue: 42,
194 wantErr: testErr,
195 },
196 {
197 name: "GetErr/NilError",
198 setForTestValue: 42,
199 setForTestErr: nil,
200 getValue: 8,
201 getErr: opt.ValueOf(errors.New("ka-boom")),
202 wantValue: 42,
203 wantErr: nil,
204 },
205 {
206 name: "GetErr/WithInitErr",
207 initValue: opt.ValueOf(4),
208 initErr: opt.ValueOf(errors.New("blast")),
209 setForTestValue: 42,

Callers

nothing calls this directly

Calls 15

ValueOfFunction · 0.92
PeekErrMethod · 0.80
RunMethod · 0.65
GetMethod · 0.65
FatalfMethod · 0.65
CleanupMethod · 0.65
FatalMethod · 0.65
ErrorfMethod · 0.65
AddMethod · 0.65
DoneMethod · 0.65
WaitMethod · 0.65
NewMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…