Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-cmds
Commits
dfa807e5
Commit
dfa807e5
authored
Oct 17, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Oct 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/cli: Fixed test for new parsing
parent
9705b56b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
cli/parse_test.go
cli/parse_test.go
+3
-9
No files found.
cli/parse_test.go
View file @
dfa807e5
...
...
@@ -15,13 +15,7 @@ func TestOptionParsing(t *testing.T) {
}
cmd
.
Register
(
"test"
,
&
commands
.
Command
{})
path
:=
[]
string
{
"test"
}
options
,
err
:=
cmd
.
GetOptions
(
path
)
if
err
!=
nil
{
t
.
Error
(
err
)
}
opts
,
input
,
err
:=
parseOptions
([]
string
{
"--beep"
,
"--boop=5 lol"
,
"test2"
,
"-cVb"
,
"beep"
},
options
)
opts
,
input
,
err
:=
parseOptions
([]
string
{
"--beep"
,
"-boop=lol"
,
"test2"
,
"-c"
,
"beep"
,
"--foo=5"
})
/*for k, v := range opts {
fmt.Printf("%s: %s\n", k, v)
}
...
...
@@ -29,10 +23,10 @@ func TestOptionParsing(t *testing.T) {
if
err
!=
nil
{
t
.
Error
(
"Should have passed"
)
}
if
len
(
opts
)
!=
5
||
opts
[
"
c"
]
!=
""
||
opts
[
"V
"
]
!=
""
||
opts
[
"b
ee
p"
]
!=
""
||
opts
[
"
boop
"
]
!=
"
5 lol
"
||
opts
[
"
b
"
]
!=
"
beep
"
{
if
len
(
opts
)
!=
4
||
opts
[
"
beep
"
]
!=
""
||
opts
[
"b
oo
p"
]
!=
"
lol
"
||
opts
[
"
c
"
]
!=
""
||
opts
[
"
foo
"
]
!=
"
5
"
{
t
.
Error
(
"Returned options were defferent than expected: %v"
,
opts
)
}
if
len
(
input
)
!=
1
||
input
[
0
]
!=
"test2"
{
if
len
(
input
)
!=
2
||
input
[
0
]
!=
"test2"
||
input
[
1
]
!=
"beep"
{
t
.
Error
(
"Returned input was different than expected: %v"
,
input
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment