mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

I want to use the Addrs type in another experimental proxy that I am implementing. Pull it out into a separate package.
29 lines
414 B
Go
29 lines
414 B
Go
package flags
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestProxySet(t *testing.T) {
|
|
tests := []struct {
|
|
val string
|
|
pass bool
|
|
}{
|
|
// known values
|
|
{"on", true},
|
|
{"off", true},
|
|
|
|
// unrecognized values
|
|
{"foo", false},
|
|
{"", false},
|
|
}
|
|
|
|
for i, tt := range tests {
|
|
pf := new(Proxy)
|
|
err := pf.Set(tt.val)
|
|
if tt.pass != (err == nil) {
|
|
t.Errorf("#%d: want pass=%t, but got err=%v", i, tt.pass, err)
|
|
}
|
|
}
|
|
}
|