@@ -29,24 +29,27 @@ func TestNew(t *testing.T) {
2929 {
3030 desc : "no options" ,
3131 c : & Client {
32- flags : make ([]string , 0 ),
33- debug : false ,
32+ flags : make ([]string , 0 ),
33+ ofctlFlags : make ([]string , 0 ),
34+ debug : false ,
3435 },
3536 },
3637 {
3738 desc : "Timeout(2)" ,
3839 options : []OptionFunc {Timeout (2 )},
3940 c : & Client {
40- flags : []string {"--timeout=2" },
41- debug : false ,
41+ flags : []string {"--timeout=2" },
42+ ofctlFlags : make ([]string , 0 ),
43+ debug : false ,
4244 },
4345 },
4446 {
4547 desc : "Debug(true)" ,
4648 options : []OptionFunc {Debug (true )},
4749 c : & Client {
48- flags : make ([]string , 0 ),
49- debug : true ,
50+ flags : make ([]string , 0 ),
51+ ofctlFlags : make ([]string , 0 ),
52+ debug : true ,
5053 },
5154 },
5255 {
@@ -72,8 +75,9 @@ func TestNew(t *testing.T) {
7275 Debug (true ),
7376 },
7477 c : & Client {
75- flags : []string {"--timeout=5" },
76- debug : true ,
78+ flags : []string {"--timeout=5" },
79+ ofctlFlags : make ([]string , 0 ),
80+ debug : true ,
7781 },
7882 },
7983 {
@@ -82,8 +86,19 @@ func TestNew(t *testing.T) {
8286 Sudo (),
8387 },
8488 c : & Client {
85- flags : make ([]string , 0 ),
86- sudo : true ,
89+ flags : make ([]string , 0 ),
90+ ofctlFlags : make ([]string , 0 ),
91+ sudo : true ,
92+ },
93+ },
94+ {
95+ desc : "SetSSLParam(pkey, cert, cacert)" ,
96+ options : []OptionFunc {
97+ SetSSLParam ("privkey.pem" , "cert.pem" , "cacert.pem" ),
98+ },
99+ c : & Client {
100+ flags : make ([]string , 0 ),
101+ ofctlFlags : []string {"--private-key=privkey.pem" , "--certificate=cert.pem" , "--ca-cert=cacert.pem" },
87102 },
88103 },
89104 }
@@ -101,6 +116,15 @@ func TestNew(t *testing.T) {
101116 t .Fatalf ("unexpected Client.debug:\n - want: %v\n - got: %v" ,
102117 want , got )
103118 }
119+ if want , got := tt .c .sudo , c .sudo ; ! reflect .DeepEqual (want , got ) {
120+ t .Fatalf ("unexpected Client.sudo:\n - want: %v\n - got: %v" ,
121+ want , got )
122+ }
123+
124+ if want , got := tt .c .ofctlFlags , c .ofctlFlags ; ! reflect .DeepEqual (want , got ) {
125+ t .Fatalf ("unexpected Client.ofctlFlags:\n - want: %v\n - got: %v" ,
126+ want , got )
127+ }
104128 })
105129 }
106130}
0 commit comments