Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tests: add test for WithMockStdout
  • Loading branch information
cognifloyd committed May 12, 2022
commit 0a0f0bd5e11ce5ebf787beccb5dfcfa3dc4bb911
36 changes: 36 additions & 0 deletions executor/local/opts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,39 @@ func TestLocal_Opt_WithVersion(t *testing.T) {
})
}
}

func TestLocal_Opt_WithMockStdout(t *testing.T) {
// setup tests
tests := []struct {
name string
mock bool
wantNil bool
}{
{
name: "standard",
mock: false,
wantNil: true,
},
{
name: "mocked",
mock: true,
wantNil: false,
},
}

// run tests
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
_engine, err := New(
WithMockStdout(test.mock),
)
if err != nil {
t.Errorf("unable to create local engine: %v", err)
}

if !reflect.DeepEqual(_engine.MockStdout() == nil, test.wantNil) {
t.Errorf("WithMockStdout is %v, wantNil = %v", _engine.MockStdout() == nil, test.wantNil)
}
})
}
}