MCPcopy Index your code
hub / github.com/coder/coder / TestLazyWithErrorPointers

Function TestLazyWithErrorPointers

coderd/util/lazy/valuewitherror_test.go:36–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestLazyWithErrorPointers(t *testing.T) {
37 t.Parallel()
38
39 a := 1
40 l := lazy.NewWithError(func() (*int, error) {
41 return &a, nil
42 })
43
44 b, err := l.Load()
45 require.NoError(t, err)
46 c, err := l.Load()
47 require.NoError(t, err)
48
49 *b++
50 *c++
51 require.Equal(t, 3, a)
52}

Callers

nothing calls this directly

Calls 3

NewWithErrorFunction · 0.92
LoadMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected