Files
thanks/internal/runner/runner_test.go
2026-01-31 00:29:33 -05:00

33 lines
639 B
Go

package runner_test
import (
"context"
"os/exec"
"testing"
"git.gentoo.party/sam/thanks/internal/runner"
"github.com/stretchr/testify/assert"
)
func Test_ZCommand(t *testing.T) {
localRunner := &runner.ZRunner{
Prog: "/bin/sh",
Args: []string{"-c"},
}
zfsList := "zfs list %s"
out, err := localRunner.Run(context.TODO(), zfsList, "zroot")
if err != nil {
t.Errorf("localRunner failed: %s\n\n%s", err.Error(), out)
}
}
func Test_Pipelie(t *testing.T) {
c1 := exec.Command("echo", "-n", "foo")
c2 := exec.Command("rev")
out, err := runner.Pipeline(c1, c2)
assert.Equal(t, "oof", string(out))
assert.Nil(t, err)
}