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.
 
 
 
 
 
 

21 lines
663 B

package console
import "testing"
func TestNormalizeAppNames(t *testing.T) {
cases := map[string]string{
"": "",
" ": "",
"Voitrans": "Voitrans",
" Voitrans , Lumi ": "Voitrans,Lumi",
"Voitrans,Voitrans": "Voitrans", // 去重
"Voitrans,,Lumi,": "Voitrans,Lumi", // 去空项
"Lumi,Voitrans": "Lumi,Voitrans", // 保序(不排序,尊重勾选顺序)
"Voitrans,Lumi,Voitrans": "Voitrans,Lumi",
}
for in, want := range cases {
if got := normalizeAppNames(in); got != want {
t.Errorf("normalizeAppNames(%q) = %q, want %q", in, got, want)
}
}
}