MCPcopy Create free account
hub / github.com/google/gapid / TestCommandEnvironment

Function TestCommandEnvironment

core/os/shell/command_test.go:99–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

97}
98
99func TestCommandEnvironment(t *testing.T) {
100 const expect = "message from environment\n"
101 ctx := log.Testing(t)
102 buf := &bytes.Buffer{}
103 env := shell.NewEnv().Set("MESSAGE", "message from environment")
104 err := shell.Command("printenv", "MESSAGE").
105 Capture(buf, nil).
106 Env(env).
107 Run(ctx)
108 assert.For(ctx, "err").ThatError(err).Succeeded()
109 assert.For(ctx, "buf").ThatString(buf).Equals(expect)
110}
111
112type errorTarget struct{}
113

Callers

nothing calls this directly

Calls 11

NewEnvMethod · 0.80
EnvMethod · 0.80
SucceededMethod · 0.80
ThatErrorMethod · 0.80
ForMethod · 0.80
ThatStringMethod · 0.80
SetMethod · 0.65
RunMethod · 0.65
CaptureMethod · 0.65
CommandMethod · 0.65
EqualsMethod · 0.65

Tested by

no test coverage detected