forked from openebs/openebs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from kartouch/785-unit-test-commands
openebs#785 add command unit test
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package command | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestNewCommand(t *testing.T) { | ||
cases := []struct { | ||
use string | ||
}{ | ||
{"start"}, {"version"}, | ||
} | ||
|
||
cmd := NewCommand() | ||
cmds := cmd.Commands() | ||
|
||
if len(cmds) != len(cases) { | ||
t.Errorf("ExpectedCommands: %d ActualCommands: '%d'", len(cases), len(cmds)) | ||
} | ||
|
||
for i, c := range cases { | ||
if c.use != cmds[i].Use { | ||
t.Errorf("ExpectedCommand: '%s' ActualCommand: '%s'", c.use, cmds[i].Use) | ||
} | ||
} | ||
|
||
} |