mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
523 B
37 lines
523 B
3 years ago
|
package util
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestGetIPLoc(t *testing.T) {
|
||
|
type args struct {
|
||
|
ip string
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want string
|
||
|
}{
|
||
|
{
|
||
|
name: "test1",
|
||
|
args: args{
|
||
|
ip: "",
|
||
|
},
|
||
|
want: "",
|
||
|
},
|
||
|
{
|
||
|
name: "test2",
|
||
|
args: args{
|
||
|
ip: "103.197.70.244",
|
||
|
},
|
||
|
want: "香港",
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := GetIPLoc(tt.args.ip); got != tt.want {
|
||
|
t.Errorf("GetIPLoc() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|