1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 18:13:54 +08:00

commands/cli: Added path/args test

This commit is contained in:
Matt Bell
2014-10-14 12:48:38 -07:00
committed by Juan Batiz-Benet
parent 4bd3a77778
commit f437230d88

View File

@ -3,6 +3,8 @@ package cli
import (
//"fmt"
"testing"
"github.com/jbenet/go-ipfs/commands"
)
func TestOptionParsing(t *testing.T) {
@ -20,4 +22,17 @@ func TestOptionParsing(t *testing.T) {
if len(input) != 2 || input[0] != "test" || input[1] != "test2" {
t.Error("Returned input was different than expected: %v", input)
}
cmd := &commands.Command{}
cmd.Register("test", &commands.Command{})
path, args, err := path([]string{ "test", "beep", "boop" }, cmd)
if err != nil {
t.Error("Should have passed")
}
if len(path) != 1 || path[0] != "test" {
t.Error("Returned path was defferent than expected: %v", path)
}
if len(args) != 2 || args[0] != "beep" || args[1] != "boop" {
t.Error("Returned args were different than expected: %v", args)
}
}