From 844a0ddfccf65890a41d917b64e6c6fc07014f25 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sat, 15 Mar 2014 10:31:26 +0800 Subject: [PATCH] update tests for time with zone --- main_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main_test.go b/main_test.go index 65caf58d..87fa9b21 100644 --- a/main_test.go +++ b/main_test.go @@ -1709,8 +1709,9 @@ func TestTimeWithZone(t *testing.T) { times = append(times, time.Date(2013, 02, 19, 1, 51, 49, 123456789, GMT8)) times = append(times, time.Date(2013, 02, 18, 17, 51, 49, 123456789, time.UTC)) - for _, vtime := range times { - user := User{Name: "time_with_zone", Birthday: vtime} + for index, vtime := range times { + name := "time_with_zone_" + strconv.Itoa(index) + user := User{Name: name, Birthday: vtime} db.Save(&user) if user.Birthday.UTC().Format(format) != "2013-02-18 17:51:49 +0000" { t.Errorf("User's birthday should not be changed after save") @@ -1721,7 +1722,7 @@ func TestTimeWithZone(t *testing.T) { } var findUser User - db.First(&findUser, "name = ?", "time_with_zone") + db.First(&findUser, "name = ?", name) if findUser.Birthday.UTC().Format(format) != "2013-02-18 17:51:49 +0000" { t.Errorf("User's birthday should not be changed after find") }