Make Command accessible from Context

This commit is contained in:
Chris Winslett
2014-03-29 12:02:05 -07:00
parent 3fa24ca4f3
commit c69522c960
3 changed files with 6 additions and 1 deletions

View File

@@ -11,9 +11,12 @@ func TestNewContext(t *testing.T) {
set.Int("myflag", 12, "doc")
globalSet := flag.NewFlagSet("test", 0)
globalSet.Int("myflag", 42, "doc")
command := cli.Command{Name: "mycommand"}
c := cli.NewContext(nil, set, globalSet)
c.Command = command
expect(t, c.Int("myflag"), 12)
expect(t, c.GlobalInt("myflag"), 42)
expect(t, c.Command.Name, "mycommand")
}
func TestContext_Int(t *testing.T) {