MCPcopy
hub / github.com/bitfield/script / TestExecRunsShWithEchoHelloAndGetsOutputHello

Function TestExecRunsShWithEchoHelloAndGetsOutputHello

script_unix_test.go:25–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23}
24
25func TestExecRunsShWithEchoHelloAndGetsOutputHello(t *testing.T) {
26 t.Parallel()
27 p := script.Exec("sh -c 'echo hello'")
28 if p.Error() != nil {
29 t.Fatal(p.Error())
30 }
31 want := "hello\n"
32 got, err := p.String()
33 if err != nil {
34 t.Fatal(err)
35 }
36 if want != got {
37 t.Error(cmp.Diff(want, got))
38 }
39}
40
41func TestExecRunsShWithinShWithEchoInceptionAndGetsOutputInception(t *testing.T) {
42 t.Parallel()

Callers

nothing calls this directly

Calls 3

ExecFunction · 0.92
ErrorMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…