File tree 2 files changed +41
-9
lines changed
2 files changed +41
-9
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ import (
14
14
"github.com/zalando/skipper/filters/openpolicyagent"
15
15
"github.com/zalando/skipper/net"
16
16
"github.com/zalando/skipper/proxy"
17
- "gopkg.in/yaml.v2"
18
17
19
18
"github.com/google/go-cmp/cmp"
20
19
"github.com/google/go-cmp/cmp/cmpopts"
@@ -482,11 +481,3 @@ func TestDeprecatedFlags(t *testing.T) {
482
481
}
483
482
}
484
483
}
485
-
486
- func TestMultiFlagYamlErr (t * testing.T ) {
487
- m := & multiFlag {}
488
- err := yaml .Unmarshal ([]byte (`foo=bar` ), m )
489
- if err == nil {
490
- t .Error ("Failed to get error on wrong yaml input" )
491
- }
492
- }
Original file line number Diff line number Diff line change
1
+ package config
2
+
3
+ import (
4
+ "testing"
5
+
6
+ "github.com/stretchr/testify/assert"
7
+ "github.com/stretchr/testify/require"
8
+ "gopkg.in/yaml.v2"
9
+ )
10
+
11
+ func TestMultiFlagSet (t * testing.T ) {
12
+ for _ , tc := range []struct {
13
+ name string
14
+ args string
15
+ values string
16
+ }{
17
+ {
18
+ name : "single value" ,
19
+ args : "foo=bar" ,
20
+ values : "foo=bar" ,
21
+ },
22
+ {
23
+ name : "multiple values" ,
24
+ args : "foo=bar foo=baz foo=qux bar=baz" ,
25
+ values : "foo=bar foo=baz foo=qux bar=baz" ,
26
+ },
27
+ } {
28
+ t .Run (tc .name + "_valid" , func (t * testing.T ) {
29
+ multiFlag := & multiFlag {}
30
+ err := multiFlag .Set (tc .args )
31
+ require .NoError (t , err )
32
+ assert .Equal (t , tc .values , multiFlag .String ())
33
+ })
34
+ }
35
+ }
36
+
37
+ func TestMultiFlagYamlErr (t * testing.T ) {
38
+ m := & multiFlag {}
39
+ err := yaml .Unmarshal ([]byte (`-foo=bar` ), m )
40
+ require .Error (t , err , "Failed to get error on wrong yaml input" )
41
+ }
You can’t perform that action at this time.
0 commit comments