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
b31facdf
Commit
b31facdf
authored
May 02, 2015
by
Christian Couder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse_test: move helper functions
License: MIT Signed-off-by:
Christian Couder
<
chriscool@tuxfamily.org
>
parent
15e3579a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
cli/parse_test.go
cli/parse_test.go
+24
-24
No files found.
cli/parse_test.go
View file @
b31facdf
...
...
@@ -7,6 +7,30 @@ import (
"github.com/ipfs/go-ipfs/commands"
)
type
kvs
map
[
string
]
interface
{}
type
words
[]
string
func
sameWords
(
a
words
,
b
words
)
bool
{
for
i
,
w
:=
range
a
{
if
w
!=
b
[
i
]
{
return
false
}
}
return
true
}
func
sameKVs
(
a
kvs
,
b
kvs
)
bool
{
if
len
(
a
)
!=
len
(
b
)
{
return
false
}
for
k
,
v
:=
range
a
{
if
v
!=
b
[
k
]
{
return
false
}
}
return
true
}
func
TestOptionParsing
(
t
*
testing
.
T
)
{
subCmd
:=
&
commands
.
Command
{}
cmd
:=
&
commands
.
Command
{
...
...
@@ -19,30 +43,6 @@ func TestOptionParsing(t *testing.T) {
},
}
type
kvs
map
[
string
]
interface
{}
type
words
[]
string
sameWords
:=
func
(
a
words
,
b
words
)
bool
{
for
i
,
w
:=
range
a
{
if
w
!=
b
[
i
]
{
return
false
}
}
return
true
}
sameKVs
:=
func
(
a
kvs
,
b
kvs
)
bool
{
if
len
(
a
)
!=
len
(
b
)
{
return
false
}
for
k
,
v
:=
range
a
{
if
v
!=
b
[
k
]
{
return
false
}
}
return
true
}
testHelper
:=
func
(
args
string
,
expectedOpts
kvs
,
expectedWords
words
,
expectErr
bool
)
{
_
,
opts
,
input
,
_
,
err
:=
parseOpts
(
strings
.
Split
(
args
,
" "
),
cmd
)
if
expectErr
{
...
...
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