mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
28 lines
471 B
Go
28 lines
471 B
Go
//go:build !windows && !plan9 && !js
|
|
|
|
package eval_test
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
|
|
"golang.org/x/sys/unix"
|
|
. "src.elv.sh/pkg/eval"
|
|
"src.elv.sh/pkg/testutil"
|
|
|
|
. "src.elv.sh/pkg/eval/evaltest"
|
|
)
|
|
|
|
func TestSleep_Interrupt(t *testing.T) {
|
|
testutil.Set(t, TimeAfter,
|
|
func(fm *Frame, d time.Duration) <-chan time.Time {
|
|
go unix.Kill(os.Getpid(), unix.SIGINT)
|
|
return time.After(d)
|
|
})
|
|
|
|
Test(t,
|
|
That(`sleep 1s`).Throws(ErrInterrupted, "sleep 1s"),
|
|
)
|
|
}
|