1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2024-12-05 03:58:29 +02:00
pocketbase/tools/routine/routine_test.go

28 lines
341 B
Go
Raw Normal View History

2022-07-06 23:19:05 +02:00
package routine_test
import (
"sync"
"testing"
"github.com/pocketbase/pocketbase/tools/routine"
)
func TestFireAndForget(t *testing.T) {
called := false
fn := func() {
called = true
panic("test")
}
wg := &sync.WaitGroup{}
routine.FireAndForget(fn, wg)
wg.Wait()
if !called {
t.Error("Expected fn to be called.")
}
}