main
Lynn Cyrin 4 years ago
parent b62c6419cb
commit 1651eec7b8
No known key found for this signature in database
GPG Key ID: 9E60BEE0555C367B

@ -33,6 +33,10 @@ func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context {
if parentCtx != nil {
c.Context = parentCtx.Context
c.shellComplete = parentCtx.shellComplete
if parentCtx.flagSet == nil {
parentCtx.flagSet = &flag.FlagSet{}
}
}
c.Command = &Command{}

@ -380,8 +380,8 @@ func TestContextAttributeAccessing(t *testing.T) {
for _, test := range tdata {
t.Run(test.testCase, func(t *testing.T) {
// setup
set := flag.NewFlagSet("test", 0)
set.Bool(test.setBoolInput, false, "doc")
set := flag.NewFlagSet("some-flag-set-name", 0)
set.Bool(test.setBoolInput, false, "usage documentation")
ctx := NewContext(nil, set, test.newContextInput)
// logic under test
@ -389,7 +389,7 @@ func TestContextAttributeAccessing(t *testing.T) {
// assertions
if value != false {
t.Errorf("expected test.value to be false, but it was not")
t.Errorf("expected \"value\" to be false, but it was not")
}
})
}

Loading…
Cancel
Save