Move subtests of TestGlobalHelp into actual subtests

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2019-04-26 10:37:26 +01:00
parent 301c638d83
commit d57175aa2e
1 changed files with 14 additions and 10 deletions

View File

@ -74,18 +74,22 @@ func TestGlobalHelp(t *testing.T) {
assert.Assert(t, is.Equal(badmetacount, 1)) assert.Assert(t, is.Equal(badmetacount, 1))
// Running with `--help` should produce the same. // Running with `--help` should produce the same.
res2 := icmd.RunCmd(run("--help")) t.Run("help_flag", func(t *testing.T) {
res2.Assert(t, icmd.Expected{ res2 := icmd.RunCmd(run("--help"))
ExitCode: 0, res2.Assert(t, icmd.Expected{
ExitCode: 0,
})
assert.Assert(t, is.Equal(res2.Stdout(), res.Stdout()))
assert.Assert(t, is.Equal(res2.Stderr(), ""))
}) })
assert.Assert(t, is.Equal(res2.Stdout(), res.Stdout()))
assert.Assert(t, is.Equal(res2.Stderr(), ""))
// Running just `docker` (without `help` nor `--help`) should produce the same thing, except on Stderr. // Running just `docker` (without `help` nor `--help`) should produce the same thing, except on Stderr.
res2 = icmd.RunCmd(run()) t.Run("bare", func(t *testing.T) {
res2.Assert(t, icmd.Expected{ res2 := icmd.RunCmd(run())
ExitCode: 0, res2.Assert(t, icmd.Expected{
ExitCode: 0,
})
assert.Assert(t, is.Equal(res2.Stdout(), ""))
assert.Assert(t, is.Equal(res2.Stderr(), res.Stdout()))
}) })
assert.Assert(t, is.Equal(res2.Stdout(), ""))
assert.Assert(t, is.Equal(res2.Stderr(), res.Stdout()))
} }