mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-04 02:37:50 +08:00
22 lines
366 B
Go
22 lines
366 B
Go
//go:build unix
|
|
|
|
package eval_test
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
|
|
"golang.org/x/sys/unix"
|
|
"src.elv.sh/pkg/eval"
|
|
"src.elv.sh/pkg/testutil"
|
|
)
|
|
|
|
func injectTimeAfterWithSIGINTOrSkip(t *testing.T) {
|
|
testutil.Set(t, eval.TimeAfter,
|
|
func(_ *eval.Frame, d time.Duration) <-chan time.Time {
|
|
go unix.Kill(os.Getpid(), unix.SIGINT)
|
|
return time.After(d)
|
|
})
|
|
}
|