@@ -12,8 +12,8 @@ import (
1212
1313func MockValidator (name string , called * int , succeed bool ) ValidatorContext {
1414 return ValidatorContext {
15- name ,
16- func (_ * flag.FlagSet ) error {
15+ Key : name ,
16+ V : func (_ * flag.FlagSet ) error {
1717 * called ++
1818
1919 if ! succeed {
@@ -41,71 +41,71 @@ var _ = Describe("Main", func() {
4141 It ("should call all validators" , func () {
4242 var called int
4343 table := []struct {
44+ Contexts []ValidatorContext
4445 ExpectedCalls int
4546 Success bool
46- Contexts []ValidatorContext
4747 }{
4848 {
49- 0 ,
50- true ,
51- [] ValidatorContext {} ,
49+ Contexts : [] ValidatorContext {} ,
50+ ExpectedCalls : 0 ,
51+ Success : true ,
5252 },
5353 {
54- 0 ,
55- true ,
56- []ValidatorContext {
54+ Contexts : []ValidatorContext {
5755 MockValidator ("no-flag-set" , & called , true ),
5856 },
57+ ExpectedCalls : 0 ,
58+ Success : true ,
5959 },
6060 {
61- 1 ,
62- true ,
63- []ValidatorContext {
61+ Contexts : []ValidatorContext {
6462 MockValidator ("validator-1" , & called , true ),
6563 },
64+ ExpectedCalls : 1 ,
65+ Success : true ,
6666 },
6767 {
68- 1 ,
69- true ,
70- []ValidatorContext {
68+ Contexts : []ValidatorContext {
7169 MockValidator ("no-flag-set" , & called , true ),
7270 MockValidator ("validator-1" , & called , true ),
7371 },
72+ ExpectedCalls : 1 ,
73+ Success : true ,
7474 },
7575 {
76- 2 ,
77- true ,
78- []ValidatorContext {
76+ Contexts : []ValidatorContext {
7977 MockValidator ("validator-1" , & called , true ),
8078 MockValidator ("validator-2" , & called , true ),
8179 },
80+ ExpectedCalls : 2 ,
81+ Success : true ,
8282 },
8383 {
84- 3 ,
85- true ,
86- []ValidatorContext {
84+ Contexts : []ValidatorContext {
8785 MockValidator ("validator-1" , & called , true ),
8886 MockValidator ("validator-2" , & called , true ),
8987 MockValidator ("validator-3" , & called , true ),
9088 },
89+ ExpectedCalls : 3 ,
90+ Success : true ,
9191 },
9292 {
93- 3 ,
94- false ,
95- []ValidatorContext {
93+ Contexts : []ValidatorContext {
9694 MockValidator ("validator-1" , & called , false ),
9795 MockValidator ("validator-2" , & called , true ),
9896 MockValidator ("validator-3" , & called , true ),
9997 },
98+ ExpectedCalls : 3 ,
99+ Success : false ,
100100 },
101101 {
102- 3 ,
103- false ,
104- []ValidatorContext {
102+ Contexts : []ValidatorContext {
105103 MockValidator ("validator-1" , & called , true ),
106104 MockValidator ("validator-2" , & called , true ),
107105 MockValidator ("validator-3" , & called , false ),
108106 },
107+ ExpectedCalls : 3 ,
108+ Success : false ,
109109 },
110110 }
111111
@@ -120,9 +120,9 @@ var _ = Describe("Main", func() {
120120
121121 Describe ("CLI argument validation" , func () {
122122 type testCase struct {
123+ ValidatorContext ValidatorContext
123124 Flag string
124125 Value string
125- ValidatorContext ValidatorContext
126126 ExpError bool
127127 }
128128
0 commit comments