~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/cmd/help_test.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
        }{
42
42
                {
43
43
                        message:   "no args shows help",
44
 
                        helpMatch: "usage: jujutest .*",
 
44
                        helpMatch: "Usage: jujutest .*",
45
45
                }, {
46
46
                        message:     "usage prefix with help command",
47
47
                        args:        []string{"help"},
48
48
                        usagePrefix: "juju",
49
 
                        helpMatch:   "usage: juju jujutest .*",
 
49
                        helpMatch:   "Usage: juju jujutest .*",
50
50
                }, {
51
51
                        message:     "usage prefix with help flag",
52
52
                        args:        []string{"--help"},
53
53
                        usagePrefix: "juju",
54
 
                        helpMatch:   "usage: juju jujutest .*",
 
54
                        helpMatch:   "Usage: juju jujutest .*",
55
55
                }, {
56
56
                        message:   "help arg usage",
57
57
                        args:      []string{"blah", "--help"},
58
 
                        helpMatch: "usage: jujutest blah.*blah-doc.*",
 
58
                        helpMatch: "Usage: jujutest blah.*blah-doc.*",
59
59
                }, {
60
60
                        message:     "usage prefix with help command",
61
61
                        args:        []string{"help", "blah"},
62
62
                        usagePrefix: "juju",
63
 
                        helpMatch:   "usage: juju jujutest blah .*",
 
63
                        helpMatch:   "Usage: juju jujutest blah .*",
64
64
                }, {
65
65
                        message:     "usage prefix with help flag",
66
66
                        args:        []string{"blah", "--help"},
67
67
                        usagePrefix: "juju",
68
 
                        helpMatch:   "usage: juju jujutest blah .*",
 
68
                        helpMatch:   "Usage: juju jujutest blah .*",
69
69
                }, {
70
70
                        message:  "too many args",
71
71
                        args:     []string{"help", "blah", "blah"},
108
108
 
109
109
        ctx, err := cmdtesting.RunCommand(c, level1, "help", "level2", "level3", "blah")
110
110
        c.Assert(err, jc.ErrorIsNil)
111
 
        s.assertStdOutMatches(c, ctx, "usage: level1 level2 level3 blah.*blah-doc.*")
 
111
        s.assertStdOutMatches(c, ctx, "Usage: level1 level2 level3 blah.*blah-doc.*")
112
112
 
113
113
        _, err = cmdtesting.RunCommand(c, level1, "help", "level2", "missing", "blah")
114
114
        c.Assert(err, gc.ErrorMatches, `subcommand "missing" not found`)
121
121
        code := cmd.Main(super, ctx, []string{"help", "alias"})
122
122
        c.Assert(code, gc.Equals, 0)
123
123
        stripped := strings.Replace(bufferString(ctx.Stdout), "\n", "", -1)
124
 
        c.Assert(stripped, gc.Matches, "usage: super blah .*aliases: alias")
 
124
        c.Assert(stripped, gc.Matches, "Usage: super blah .*Aliases: alias")
125
125
}
126
126
 
127
127
func (s *HelpCommandSuite) TestRegisterSuperAliasHelp(c *gc.C) {
155
155
                ctx := cmdtesting.Context(c)
156
156
                code := cmd.Main(jc, ctx, test.args)
157
157
                c.Check(code, gc.Equals, 0)
158
 
                help := "usage: jujutest bar foo\npurpose: to be simple\n"
 
158
                help := "Usage: jujutest bar foo\n\nSummary:\nto be simple\n"
159
159
                c.Check(cmdtesting.Stdout(ctx), gc.Equals, help)
160
160
        }
161
161
}