1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 16:40:50 +00:00

fix: adding test for issue due to testing is not reflect changed

This commit is contained in:
Witaya Tospitakkul 2019-01-25 09:04:01 +07:00
parent 920207f72c
commit bd1b421491

View File

@ -146,7 +146,7 @@ func TestParseForm(t *testing.T) {
"date": []string{"2014-11-12"},
"organization": []string{"beego"},
"title": []string{"CXO"},
"hobby": []string{"Basketball", "Football"},
"hobby": []string{"", "Basketball", "Football"},
"memo": []string{"nothing"},
}
if err := ParseForm(form, u); err == nil {
@ -186,11 +186,14 @@ func TestParseForm(t *testing.T) {
if u.Title != "CXO" {
t.Errorf("Title should equal `CXO`, but got `%v`", u.Title)
}
if u.Hobby[0] != "Basketball" {
t.Errorf("Hobby should equal `Basketball`, but got `%v`", u.Hobby[0])
if u.Hobby[0] != "" {
t.Errorf("Hobby should equal ``, but got `%v`", u.Hobby[0])
}
if u.Hobby[1] != "Football" {
t.Errorf("Hobby should equal `Football`, but got `%v`", u.Hobby[1])
if u.Hobby[1] != "Basketball" {
t.Errorf("Hobby should equal `Basketball`, but got `%v`", u.Hobby[1])
}
if u.Hobby[2] != "Football" {
t.Errorf("Hobby should equal `Football`, but got `%v`", u.Hobby[2])
}
if len(u.Memo) != 0 {
t.Errorf("Memo's length should equal 0 but got %v", len(u.Memo))