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-unixfs
Commits
b3eecf4f
Commit
b3eecf4f
authored
10 years ago
by
Matt Bell
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/cli: Added simple option parser test
parent
bf328181
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
commands/cli/parse_test.go
commands/cli/parse_test.go
+23
-0
No files found.
commands/cli/parse_test.go
0 → 100644
View file @
b3eecf4f
package
cli
import
(
//"fmt"
"testing"
)
func
TestOptionParsing
(
t
*
testing
.
T
)
{
opts
,
input
,
err
:=
options
([]
string
{
"test"
,
"--beep"
,
"--boop=
\"
5"
,
"lol
\"
"
,
"test2"
,
"-cV"
},
nil
)
/*for k, v := range opts {
fmt.Printf("%s: %s\n", k, v)
}
fmt.Printf("%s\n", input)*/
if
err
!=
nil
{
t
.
Error
(
"Should have passed"
)
}
if
len
(
opts
)
!=
4
||
opts
[
"c"
]
!=
""
||
opts
[
"V"
]
!=
""
||
opts
[
"beep"
]
!=
""
||
opts
[
"boop"
]
!=
"5 lol"
{
t
.
Error
(
"Returned options were defferent than expected: %v"
,
opts
)
}
if
len
(
input
)
!=
2
||
input
[
0
]
!=
"test"
||
input
[
1
]
!=
"test2"
{
t
.
Error
(
"Returned input was different than expected: %v"
,
input
)
}
}
This diff is collapsed.
Click to expand it.
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