testkit/testshell
import "github.com/barevoidco/zelk/core/testkit/testshell"Package testshell finds native shells and synchronizes test commands with the tests that read their output.
func Path(t *testing.T, environ func() []string) stringPath returns the native Bash executable or fails the test if Windows does not have Git for Windows installed.
OutputSignals
Section titled “OutputSignals”type OutputSignals struct { env.Environment // contains filtered or unexported fields}OutputSignals observes a test command’s stdout checkpoints on its separate stderr stream. The command writes ! to stderr after each piece of stdout the test will read.
NewOutputSignals
Section titled “NewOutputSignals”func NewOutputSignals(e env.Environment, count int) *OutputSignalsNewOutputSignals wraps a test environment that will start one command with count stdout checkpoints.
OutputSignals.Start
Section titled “OutputSignals.Start”func (s *OutputSignals) Start(ctx context.Context, cmd env.Cmd) (env.Proc, error)Start connects the command’s stderr to its checkpoints.
OutputSignals.Wait
Section titled “OutputSignals.Wait”func (s *OutputSignals) Wait(ctx context.Context) errorWait waits for the next checkpoint without reading the command’s stdout.
OutputSignals.Write
Section titled “OutputSignals.Write”func (s *OutputSignals) Write(p []byte) (int, error)Write delivers checkpoint bytes without blocking the process’s stderr copier.