Add more tests, refactor to fix problems
Signed-off-by: Patrice Ferlet <metal3d@gmail.com>
This commit is contained in:
17
cmd/katenary/main_test.go
Normal file
17
cmd/katenary/main_test.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestBuildCommand(t *testing.T) {
|
||||
rootCmd := buildRootCmd()
|
||||
if rootCmd == nil {
|
||||
t.Errorf("Expected rootCmd to be defined")
|
||||
}
|
||||
if rootCmd.Use != "katenary" {
|
||||
t.Errorf("Expected rootCmd.Use to be katenary, got %s", rootCmd.Use)
|
||||
}
|
||||
numCommands := 5
|
||||
if len(rootCmd.Commands()) != numCommands {
|
||||
t.Errorf("Expected %d command, got %d", numCommands, len(rootCmd.Commands()))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user