ProcessQuestionPic中处理京东返回不正常图片地址的问题

This commit is contained in:
gazebo
2019-11-29 15:29:25 +08:00
parent 581b544864
commit b582b55493
3 changed files with 40 additions and 5 deletions

View File

@@ -259,3 +259,29 @@ func TestCheckSelfPickCode(t *testing.T) {
t.Fatal(err.Error())
}
}
func TestProcessQuestionPic(t *testing.T) {
for _, v := range [][]string{
[]string{
"http://img10.360buyimg.com/o2o/jfs/a.jpg",
",,,jfs/a.jpg",
},
[]string{
"http://img10.360buyimg.com/o2o/jfs/a.jpg,https://img10.360buyimg.com/o2o/jfs/b.jpg",
" , ,, jfs/a.jpg,https:jfs/b.jpg",
},
[]string{
"https://img10.360buyimg.com/o2o/jfs/a.jpg",
",https:jfs/a.jpg",
},
[]string{
"",
",https:",
},
} {
str := ProcessQuestionPic(v[1])
if str != v[0] {
t.Fatalf("%s, desired:%s, but its:%s", v[1], v[0], str)
}
}
}