MCPcopy Create free account
hub / github.com/git-bug/git-bug / TestCancel

Function TestCancel

util/interrupt/cleaner_test.go:55–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestCancel(t *testing.T) {
56 handlerCreated = true // this prevents goroutine from being started during the tests
57
58 f1 := func() error {
59 return errors.New("1")
60 }
61 f2 := func() error {
62 return errors.New("2")
63 }
64
65 cancel1 := RegisterCleaner(f1)
66 RegisterCleaner(f2)
67
68 cancel1()
69
70 errl := clean()
71 require.Len(t, errl, 1)
72
73 assert.Equal(t, "2", errl[0].Error())
74}

Callers

nothing calls this directly

Calls 5

RegisterCleanerFunction · 0.85
cleanFunction · 0.85
NewMethod · 0.45
LenMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected