-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from VinceCui/master
- Loading branch information
Showing
4 changed files
with
60 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// alibaba-inc.com Inc. | ||
// Copyright (c) 2004-2022 All Rights Reserved. | ||
// | ||
// @Author : huaiyou.cyz | ||
// @Time : 2022/5/25 4:08 PM | ||
// @File : utils_test.go | ||
// | ||
|
||
package utils | ||
|
||
import "testing" | ||
|
||
func TestSplitServer(t *testing.T) { | ||
type args struct { | ||
server string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
want1 uint16 | ||
}{ | ||
{ | ||
args: args{ | ||
server: "[1408:4003:10bb:6a01:83b9:6360:c66d:ed3e]:6443", | ||
}, | ||
want: "1408:4003:10bb:6a01:83b9:6360:c66d:ed3e", | ||
want1: 6443, | ||
}, | ||
{ | ||
args: args{ | ||
server: "1.1.1.1:6443", | ||
}, | ||
want: "1.1.1.1", | ||
want1: 6443, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, got1 := SplitServer(tt.args.server) | ||
if got != tt.want { | ||
t.Errorf("SplitServer() got = %v, want %v", got, tt.want) | ||
} | ||
if got1 != tt.want1 { | ||
t.Errorf("SplitServer() got1 = %v, want %v", got1, tt.want1) | ||
} | ||
}) | ||
} | ||
} |