cleanup tests
This commit is contained in:
parent
4381738fb5
commit
e265f5087f
17
app_test.go
17
app_test.go
@ -1189,13 +1189,12 @@ func TestRequiredFlagAppRunBehavior(t *testing.T) {
|
|||||||
|
|
||||||
func TestAppRunPassThroughRegression(t *testing.T) {
|
func TestAppRunPassThroughRegression(t *testing.T) {
|
||||||
tdata := []struct {
|
tdata := []struct {
|
||||||
testCase string
|
testCase string
|
||||||
appFlags []Flag
|
appRunInput []string
|
||||||
appRunInput []string
|
appCommands []Command
|
||||||
appCommands []Command
|
|
||||||
expectedAnError bool
|
|
||||||
}{
|
}{
|
||||||
{ // docker run --rm ubuntu bash
|
{
|
||||||
|
testCase: "test_case",
|
||||||
appRunInput: []string{"myCLI", "myCommand", "--someFlag", "someInput", "docker", "run", "--rm", "ubuntu", "bash"},
|
appRunInput: []string{"myCLI", "myCommand", "--someFlag", "someInput", "docker", "run", "--rm", "ubuntu", "bash"},
|
||||||
appCommands: []Command{{
|
appCommands: []Command{{
|
||||||
Name: "myCommand",
|
Name: "myCommand",
|
||||||
@ -1207,17 +1206,13 @@ func TestAppRunPassThroughRegression(t *testing.T) {
|
|||||||
t.Run(test.testCase, func(t *testing.T) {
|
t.Run(test.testCase, func(t *testing.T) {
|
||||||
// setup
|
// setup
|
||||||
app := NewApp()
|
app := NewApp()
|
||||||
app.Flags = test.appFlags
|
|
||||||
app.Commands = test.appCommands
|
app.Commands = test.appCommands
|
||||||
|
|
||||||
// logic under test
|
// logic under test
|
||||||
err := app.Run(test.appRunInput)
|
err := app.Run(test.appRunInput)
|
||||||
|
|
||||||
// assertions
|
// assertions
|
||||||
if test.expectedAnError && err == nil {
|
if err != nil {
|
||||||
t.Errorf("expected an error, but there was none")
|
|
||||||
}
|
|
||||||
if !test.expectedAnError && err != nil {
|
|
||||||
t.Errorf("did not expected an error, but there was one: %s", err)
|
t.Errorf("did not expected an error, but there was one: %s", err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user