package util import ( "strings" "testing" ) func TestRunSucceeds(t *testing.T) { if err := Run("sh", "-c", "exit 0"); err != nil { t.Fatalf("Run: %v", err) } } func TestRunLoggedReturnsCombinedOutput(t *testing.T) { got, err := RunLogged("sh", "-c", "printf 'hello'; printf 'world' >&2") if err != nil { t.Fatalf("RunLogged: %v", err) } if got != "helloworld" { t.Fatalf("RunLogged output = %q", got) } } func TestRunLoggedWrapsFailures(t *testing.T) { _, err := RunLogged("sh", "-c", "printf boom >&2; exit 7") if err == nil { t.Fatal("expected error") } if !strings.Contains(err.Error(), "failed") || !strings.Contains(err.Error(), "boom") { t.Fatalf("unexpected error: %v", err) } }