You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-11-26 08:01:37 +02:00
initial public commit
This commit is contained in:
27
tools/routine/routine_test.go
Normal file
27
tools/routine/routine_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
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.")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user