mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
add basic inspect test
This commit is contained in:
parent
241649fc22
commit
e92203a466
2 changed files with 19 additions and 3 deletions
|
|
@ -11,8 +11,10 @@ import (
|
|||
"github.com/pilosa/pilosa/ctl"
|
||||
)
|
||||
|
||||
var Inspector *ctl.InspectCommand
|
||||
|
||||
func NewInspectCommand(stdin io.Reader, stdout, stderr io.Writer) *cobra.Command {
|
||||
inspecter := ctl.NewInspectCommand(os.Stdin, os.Stdout, os.Stderr)
|
||||
Inspector = ctl.NewInspectCommand(os.Stdin, os.Stdout, os.Stderr)
|
||||
|
||||
inspectCmd := &cobra.Command{
|
||||
Use: "inspect",
|
||||
|
|
@ -28,8 +30,8 @@ Inspects a data file and provides stats.
|
|||
fmt.Println("only one path allowed")
|
||||
return
|
||||
}
|
||||
inspecter.Path = args[0]
|
||||
if err := inspecter.Run(context.Background()); err != nil {
|
||||
Inspector.Path = args[0]
|
||||
if err := Inspector.Run(context.Background()); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
},
|
||||
|
|
|
|||
14
cmd/inspect_test.go
Normal file
14
cmd/inspect_test.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package cmd_test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestInspectHelp(t *testing.T) {
|
||||
output := ExecNewRootCommand(t, "inspect", "--help")
|
||||
if !strings.Contains(output, "Usage:") ||
|
||||
!strings.Contains(output, "pilosa inspect") {
|
||||
t.Fatalf("Command 'inspect --help' not working, got: %s", output)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue