src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/eval/transcripts_unix_test.go (about)

     1  //go:build unix
     2  
     3  package eval_test
     4  
     5  import (
     6  	"os"
     7  	"testing"
     8  	"time"
     9  
    10  	"golang.org/x/sys/unix"
    11  	"src.elv.sh/pkg/eval"
    12  	"src.elv.sh/pkg/testutil"
    13  )
    14  
    15  func injectTimeAfterWithSIGINTOrSkip(t *testing.T) {
    16  	testutil.Set(t, eval.TimeAfter,
    17  		func(_ *eval.Frame, d time.Duration) <-chan time.Time {
    18  			go unix.Kill(os.Getpid(), unix.SIGINT)
    19  			return time.After(d)
    20  		})
    21  }