mirror of
https://github.com/pocketbase/pocketbase.git
synced 2024-11-28 18:11:17 +02:00
28 lines
341 B
Go
28 lines
341 B
Go
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.")
|
|
}
|
|
}
|