Skip to content

Commit

Permalink
tests: add test for WithMockStdout
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed May 12, 2022
1 parent ceefc0f commit 0a0f0bd
Showing 1 changed file with 36 additions and 0 deletions.
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)
}
})
}
}

0 comments on commit 0a0f0bd

Please sign in to comment.