- improve jxutils.SplitStoreName
This commit is contained in:
@@ -61,3 +61,43 @@ func TestIsMobileFake(t *testing.T) {
|
||||
t.Fatal("wrong 4")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplitStoreName(t *testing.T) {
|
||||
for _, v := range [][]string{
|
||||
[]string{
|
||||
"京西菜市 站北店",
|
||||
"京西菜市",
|
||||
"站北店",
|
||||
},
|
||||
[]string{
|
||||
"京西菜市(站北店)",
|
||||
"京西菜市",
|
||||
"站北店",
|
||||
},
|
||||
[]string{
|
||||
"京西菜市[(站北店",
|
||||
"京西菜市",
|
||||
"站北店",
|
||||
},
|
||||
[]string{
|
||||
"京西菜市 站北店)",
|
||||
"京西菜市",
|
||||
"站北店",
|
||||
},
|
||||
[]string{
|
||||
"京西菜市-站北店",
|
||||
"京西菜市",
|
||||
"站北店",
|
||||
},
|
||||
[]string{
|
||||
"站北店",
|
||||
"京西菜市",
|
||||
"站北店",
|
||||
},
|
||||
} {
|
||||
prefix, bareName := SplitStoreName(v[0], "-", "京西菜市")
|
||||
if prefix != v[1] || bareName != v[2] {
|
||||
t.Fatalf("SplitStoreName(%s) is wrong, %s, %s", v[0], prefix, bareName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user