mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 09:59:13 +08:00
commands: Fixed tests
This commit is contained in:
@ -11,7 +11,7 @@ func TestOptionParsing(t *testing.T) {
|
|||||||
subCmd := &commands.Command{}
|
subCmd := &commands.Command{}
|
||||||
cmd := &commands.Command{
|
cmd := &commands.Command{
|
||||||
Options: []commands.Option{
|
Options: []commands.Option{
|
||||||
commands.Option{Names: []string{"b"}, Type: commands.String},
|
commands.StringOption("b", "some option"),
|
||||||
},
|
},
|
||||||
Subcommands: map[string]*commands.Command{
|
Subcommands: map[string]*commands.Command{
|
||||||
"test": subCmd,
|
"test": subCmd,
|
||||||
|
@ -9,8 +9,8 @@ func noop(req Request) (interface{}, error) {
|
|||||||
func TestOptionValidation(t *testing.T) {
|
func TestOptionValidation(t *testing.T) {
|
||||||
cmd := Command{
|
cmd := Command{
|
||||||
Options: []Option{
|
Options: []Option{
|
||||||
Option{[]string{"b", "beep"}, Int, "enables beeper"},
|
IntOption("b", "beep", "enables beeper"),
|
||||||
Option{[]string{"B", "boop"}, String, "password for booper"},
|
StringOption("B", "boop", "password for booper"),
|
||||||
},
|
},
|
||||||
Run: noop,
|
Run: noop,
|
||||||
}
|
}
|
||||||
@ -93,14 +93,14 @@ func TestOptionValidation(t *testing.T) {
|
|||||||
func TestRegistration(t *testing.T) {
|
func TestRegistration(t *testing.T) {
|
||||||
cmdA := &Command{
|
cmdA := &Command{
|
||||||
Options: []Option{
|
Options: []Option{
|
||||||
Option{[]string{"beep"}, Int, "number of beeps"},
|
IntOption("beep", "number of beeps"),
|
||||||
},
|
},
|
||||||
Run: noop,
|
Run: noop,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdB := &Command{
|
cmdB := &Command{
|
||||||
Options: []Option{
|
Options: []Option{
|
||||||
Option{[]string{"beep"}, Int, "number of beeps"},
|
IntOption("beep", "number of beeps"),
|
||||||
},
|
},
|
||||||
Run: noop,
|
Run: noop,
|
||||||
Subcommands: map[string]*Command{
|
Subcommands: map[string]*Command{
|
||||||
@ -110,7 +110,7 @@ func TestRegistration(t *testing.T) {
|
|||||||
|
|
||||||
cmdC := &Command{
|
cmdC := &Command{
|
||||||
Options: []Option{
|
Options: []Option{
|
||||||
Option{[]string{"encoding"}, String, "data encoding type"},
|
StringOption("encoding", "data encoding type"),
|
||||||
},
|
},
|
||||||
Run: noop,
|
Run: noop,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user