forked from AliyunContainerService/pouch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli_help_test.go
42 lines (35 loc) · 894 Bytes
/
cli_help_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"github.com/alibaba/pouch/test/command"
"github.com/alibaba/pouch/test/environment"
"github.com/go-check/check"
"github.com/gotestyourself/gotestyourself/icmd"
)
// PouchHelpSuite is the test suite for help CLI.
type PouchHelpSuite struct{}
func init() {
check.Suite(&PouchHelpSuite{})
}
// SetUpTest does common setup in the beginning of each test.
func (suite *PouchHelpSuite) SetUpTest(c *check.C) {
SkipIfFalse(c, environment.IsLinux)
}
// TestHelpWorks tests "pouch help" work.
func (suite *PouchHelpSuite) TestHelpWorks(c *check.C) {
args := map[string]bool{
"help": true,
"--help": true,
"-h": true,
"-help": false,
"--h": false,
"--unknown": false,
}
for arg, ok := range args {
res := command.PouchRun(arg)
if ok {
res.Assert(c, icmd.Success)
} else {
c.Assert(res.Stderr(), check.NotNil)
}
}
}