File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2063,17 +2063,19 @@ func TestTimestampFlagApply_WithDestination(t *testing.T) {
20632063// Test issue #1254
20642064// StringSlice() with UseShortOptionHandling causes duplicated entries, depending on the ordering of the flags
20652065func TestSliceShortOptionHandle (t * testing.T ) {
2066- _ = (& App {
2066+ wasCalled := false
2067+ err := (& App {
20672068 Commands : []* Command {
20682069 {
20692070 Name : "foobar" ,
20702071 UseShortOptionHandling : true ,
20712072 Action : func (ctx * Context ) error {
2073+ wasCalled = true
20722074 if ctx .Bool ("i" ) != true {
2073- t .Errorf ("bool i not set" )
2075+ t .Error ("bool i not set" )
20742076 }
20752077 if ctx .Bool ("t" ) != true {
2076- t .Errorf ("bool i not set" )
2078+ t .Error ("bool i not set" )
20772079 }
20782080 ss := ctx .StringSlice ("net" )
20792081 if ! reflect .DeepEqual (ss , []string {"foo" }) {
@@ -2089,4 +2091,10 @@ func TestSliceShortOptionHandle(t *testing.T) {
20892091 },
20902092 },
20912093 }).Run ([]string {"run" , "foobar" , "--net=foo" , "-it" })
2094+ if err != nil {
2095+ t .Fatal (err )
2096+ }
2097+ if ! wasCalled {
2098+ t .Fatal ("Action callback was never called" )
2099+ }
20922100}
You can’t perform that action at this time.
0 commit comments