Fixed some lint and code convention violations
This commit is contained in:
1 parent
af7880ceac
commit
378ac59f41
6 files changed
+33
-11
No files matched your search
@@ -180,7 +180,8 @@ func TestDialModeFlags(t *testing.T) {
|
||||
{"upgrade with addr", []string{"--http-upgrade", "--addr", "h:1"}, "none of the others"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
_, err := cmdtest.Run(t, newRoot, "", append([]string{"dial"}, tt.args...)...)
|
||||
args := append([]string{"dial"}, tt.args...)
|
||||
_, err := cmdtest.Run(t, newRoot, "", args...)
|
||||
if err == nil {
|
||||
t.Errorf("%s: dial was accepted", tt.name)
|
||||
continue
|
||||
@@ -214,16 +215,25 @@ func TestDirectConn(t *testing.T) {
|
||||
// Without --addr, --direct uses the configured host and port.
|
||||
func TestDefaultAddr(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
conf config.JSCServer
|
||||
want string
|
||||
}{
|
||||
{config.JSCServer{Host: "10.0.0.1", Port: 8080}, "10.0.0.1:8080"},
|
||||
{config.JSCServer{Port: 9393}, "127.0.0.1:9393"},
|
||||
{config.JSCServer{Host: "::1", Port: 9393}, "[::1]:9393"},
|
||||
{"configured", config.JSCServer{
|
||||
Host: "10.0.0.1",
|
||||
Port: 8080,
|
||||
}, "10.0.0.1:8080"},
|
||||
{"every interface", config.JSCServer{
|
||||
Port: 9393,
|
||||
}, "127.0.0.1:9393"},
|
||||
{"IPv6", config.JSCServer{
|
||||
Host: "::1",
|
||||
Port: 9393,
|
||||
}, "[::1]:9393"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
if got := defaultAddr(tt.conf); got != tt.want {
|
||||
t.Errorf("defaultAddr(%+v) = %q; want %q", tt.conf, got, tt.want)
|
||||
t.Errorf("%s: defaultAddr = %q; want %q", tt.name, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user