mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
0adf0ec147
The unix build tag is supported by Go 1.19.
28 lines
450 B
Go
28 lines
450 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"
|
|
|
|
. "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"),
|
|
)
|
|
}
|