feat: initial public version

This commit is contained in:
Anton
2023-11-25 04:02:45 +05:00
parent ebd1d47fc6
commit 8447197d0f
64 changed files with 3880 additions and 4 deletions

29
execy/execy_test.go Normal file
View File

@@ -0,0 +1,29 @@
package execy
import (
"context"
"os/exec"
"strings"
"testing"
)
func TestRunner(t *testing.T) {
const want = "hello world"
ctx := context.Background()
cmd := exec.CommandContext(ctx, "echo", "-n", want)
outb := new(strings.Builder)
errb := new(strings.Builder)
cmd.Stdout = outb
cmd.Stderr = errb
err := Run(cmd)
if err != nil {
t.Fatalf("Err: expected nil, got %v", err)
}
if outb.String() != want {
t.Errorf("Stdout: expected %q, got %q", want, outb.String())
}
if errb.String() != "" {
t.Errorf("Stderr: expected %q, got %q", "", errb.String())
}
}