From e265f5087fd795a5314286e8e5ec19d91f58f4ae Mon Sep 17 00:00:00 2001 From: "[[ BOT ]] Lynn Cyrin" Date: Thu, 22 Aug 2019 21:22:37 -0700 Subject: [PATCH] cleanup tests --- app_test.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/app_test.go b/app_test.go index a0d17d1..9caa543 100644 --- a/app_test.go +++ b/app_test.go @@ -1189,13 +1189,12 @@ func TestRequiredFlagAppRunBehavior(t *testing.T) { func TestAppRunPassThroughRegression(t *testing.T) { tdata := []struct { - testCase string - appFlags []Flag - appRunInput []string - appCommands []Command - expectedAnError bool + testCase string + appRunInput []string + appCommands []Command }{ - { // docker run --rm ubuntu bash + { + testCase: "test_case", appRunInput: []string{"myCLI", "myCommand", "--someFlag", "someInput", "docker", "run", "--rm", "ubuntu", "bash"}, appCommands: []Command{{ Name: "myCommand", @@ -1207,17 +1206,13 @@ func TestAppRunPassThroughRegression(t *testing.T) { t.Run(test.testCase, func(t *testing.T) { // setup app := NewApp() - app.Flags = test.appFlags app.Commands = test.appCommands // logic under test err := app.Run(test.appRunInput) // assertions - if test.expectedAnError && err == nil { - t.Errorf("expected an error, but there was none") - } - if !test.expectedAnError && err != nil { + if err != nil { t.Errorf("did not expected an error, but there was one: %s", err) } })