MCPcopy Create free account
hub / github.com/commander-cli/commander / TestRuntime_WithEnvVariables

Function TestRuntime_WithEnvVariables

pkg/runtime/local_executor_test.go:10–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestRuntime_WithEnvVariables(t *testing.T) {
11 envVar := "$KEY"
12 if runtime.GOOS == "windows" {
13 envVar = "%KEY%"
14 }
15
16 s := TestCase{
17 Command: CommandUnderTest{
18 Cmd: fmt.Sprintf("echo %s", envVar),
19 Timeout: "2s",
20 Env: map[string]string{"KEY": "value"},
21 },
22 Expected: Expected{
23 Stdout: ExpectedOut{
24 Contains: []string{"value"},
25 },
26 ExitCode: 0,
27 },
28 Title: "Output env variable",
29 }
30
31 e := LocalExecutor{}
32 got := e.Execute(s)
33 assert.True(t, got.ValidationResult.Success)
34}
35
36func Test_runTestShouldReturnError(t *testing.T) {
37 test := TestCase{

Callers

nothing calls this directly

Calls 1

ExecuteMethod · 0.95

Tested by

no test coverage detected