MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / TestOnce

Function TestOnce

utils/once_test.go:25–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestOnce(t *testing.T) {
26 Convey("test once", t, func() {
27 var a = 0
28 o := Once{}
29 o.Do(func() {
30 a++
31 })
32 o.Do(func() {
33 a++
34 })
35 So(a, ShouldEqual, 1)
36 o.Reset()
37 o.Do(func() {
38 a++
39 })
40 So(a, ShouldEqual, 2)
41 })
42}

Callers

nothing calls this directly

Calls 2

DoMethod · 0.95
ResetMethod · 0.95

Tested by

no test coverage detected