Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ijaz Ahmad
ksonnet
Commits
72934a86
Unverified
Commit
72934a86
authored
Apr 10, 2018
by
bryanl
Browse files
adding tests for option loader types
Signed-off-by:
bryanl
<
bryanliles@gmail.com
>
parent
5127e0ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
10 deletions
+52
-10
actions/actions_test.go
actions/actions_test.go
+52
-10
No files found.
actions/actions_test.go
View file @
72934a86
...
...
@@ -53,19 +53,61 @@ func Test_optionsLoader_loadApp(t *testing.T) {
for
_
,
tc
:=
range
cases
{
t
.
Run
(
tc
.
name
,
func
(
t
*
testing
.
T
)
{
ol
:=
new
OptionLoader
(
tc
.
m
)
got
:=
ol
.
loadApp
()
if
tc
.
isErr
{
re
quire
.
Error
(
t
,
ol
.
err
)
return
}
require
.
NoError
(
t
,
ol
.
err
)
assert
.
Equal
(
t
,
a
,
got
)
with
OptionLoader
(
t
,
tc
.
m
,
func
(
a
*
mocks
.
App
,
ol
*
optionLoader
)
{
got
:=
ol
.
loadApp
()
if
tc
.
isErr
{
require
.
Error
(
t
,
ol
.
err
)
re
turn
}
require
.
NoError
(
t
,
ol
.
err
)
assert
.
Equal
(
t
,
a
,
got
)
}
)
})
}
})
}
// func Test_optionsLoader_loadBool(t *testing.T) {
// withApp(t, func(a *mocks.App) {
// cases := []struct {
// name string
// key string
// validCase interface{}
// invalidCase interface{}
// }{
// {
// name: "bool",
// key: OptionGcTag,
// validCase: true,
// invalidCase: "invalid"
// },
// }
// for _, tc := range cases {
// t.Run(tc.name, func(t *testing.T) {
// m := map[string]interface{
// tc.key: tc.validCase,
// }
// ol := newOptionLoader(m)
// got := ol.loadApp()
// if tc.isErr {
// require.Error(t, ol.err)
// return
// }
// require.NoError(t, ol.err)
// assert.Equal(t, a, got)
// })
// }
// })
// }
func
withOptionLoader
(
t
*
testing
.
T
,
m
map
[
string
]
interface
{},
fn
func
(
*
mocks
.
App
,
*
optionLoader
))
{
withApp
(
t
,
func
(
a
*
mocks
.
App
)
{
ol
:=
newOptionLoader
(
m
)
fn
(
a
,
ol
)
})
}
...
...
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