mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-21 00:24:07 +08:00
fix: save service config changes may send invalid action log
This commit is contained in:
@@ -166,3 +166,45 @@ func TestGenerateHostName(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetCharTypeCount(t *testing.T) {
|
||||
cases := []struct {
|
||||
in string
|
||||
want int
|
||||
}{
|
||||
{
|
||||
in: "",
|
||||
want: 0,
|
||||
},
|
||||
{
|
||||
in: "123",
|
||||
want: 1,
|
||||
},
|
||||
{
|
||||
in: "abc",
|
||||
want: 1,
|
||||
},
|
||||
{
|
||||
in: "abcAbc",
|
||||
want: 2,
|
||||
},
|
||||
{
|
||||
in: "123dbA",
|
||||
want: 3,
|
||||
},
|
||||
{
|
||||
in: "123@Acv",
|
||||
want: 4,
|
||||
},
|
||||
{
|
||||
in: "中文",
|
||||
want: 1,
|
||||
},
|
||||
}
|
||||
for _, c := range cases {
|
||||
got := GetCharTypeCount(c.in)
|
||||
if got != c.want {
|
||||
t.Errorf("GetCharTypeCount %s want %d got %d", c.in, c.want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user