提交 a9fa767b 作者: Matt Bell 提交者: Juan Batiz-Benet

commands/cli: Added test for detecting duplicate options

上级 117af86c
...@@ -30,6 +30,11 @@ func TestOptionParsing(t *testing.T) { ...@@ -30,6 +30,11 @@ func TestOptionParsing(t *testing.T) {
t.Error("Returned input was different than expected: %v", input) t.Error("Returned input was different than expected: %v", input)
} }
_, _, err = parseOptions([]string{ "-beep=1", "-boop=2", "-beep=3" })
if err == nil {
t.Error("Should have failed (duplicate option name)")
}
path, args, err := parsePath([]string{ "test", "beep", "boop" }, cmd) path, args, err := parsePath([]string{ "test", "beep", "boop" }, cmd)
if err != nil { if err != nil {
t.Error("Should have passed") t.Error("Should have passed")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论