mirror of
https://github.com/rclone/rclone.git
synced 2025-12-19 01:33:25 +00:00
vendor: update all dependencies
This commit is contained in:
31
vendor/github.com/pengsrc/go-shared/utils/recover_test.go
generated
vendored
Normal file
31
vendor/github.com/pengsrc/go-shared/utils/recover_test.go
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/pengsrc/go-shared/log"
|
||||
)
|
||||
|
||||
func TestRecover(t *testing.T) {
|
||||
discardLogger, err := log.NewLogger(ioutil.Discard)
|
||||
assert.NoError(t, err)
|
||||
log.SetGlobalLogger(discardLogger)
|
||||
defer log.SetGlobalLogger(nil)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer Recover(ctx)
|
||||
wg.Done()
|
||||
panic("fear")
|
||||
}()
|
||||
wg.Wait()
|
||||
}
|
||||
Reference in New Issue
Block a user