Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: service/datastore/properties_test.go

Issue 1289323002: Fix miscellaneous prod bugs. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Remove superfluous function added in PS#1. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package datastore 5 package datastore
6 6
7 import ( 7 import (
8 "math" 8 "math"
9 "testing" 9 "testing"
10 "time" 10 "time"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 Convey("invalid GeoPoint", func() { 87 Convey("invalid GeoPoint", func() {
88 pv := Property{} 88 pv := Property{}
89 err := pv.SetValue(GeoPoint{-1000, 0}, ShouldInd ex) 89 err := pv.SetValue(GeoPoint{-1000, 0}, ShouldInd ex)
90 So(err.Error(), ShouldContainSubstring, "invalid GeoPoint value") 90 So(err.Error(), ShouldContainSubstring, "invalid GeoPoint value")
91 So(pv.Value(), ShouldBeNil) 91 So(pv.Value(), ShouldBeNil)
92 So(pv.IndexSetting(), ShouldEqual, ShouldIndex) 92 So(pv.IndexSetting(), ShouldEqual, ShouldIndex)
93 So(pv.Type().String(), ShouldEqual, "PTNull") 93 So(pv.Type().String(), ShouldEqual, "PTNull")
94 }) 94 })
95 Convey("invalid time", func() { 95 Convey("invalid time", func() {
96 pv := Property{} 96 pv := Property{}
97 » » » » err := pv.SetValue(time.Now(), ShouldIndex) 97 » » » » loc, err := time.LoadLocation("America/Los_Angel es")
98 » » » » So(err, ShouldBeNil)
99 » » » » t := time.Date(1970, 1, 1, 0, 0, 0, 0, loc)
100
101 » » » » err = pv.SetValue(t, ShouldIndex)
98 So(err.Error(), ShouldContainSubstring, "time va lue has wrong Location") 102 So(err.Error(), ShouldContainSubstring, "time va lue has wrong Location")
99 103
100 err = pv.SetValue(time.Unix(math.MaxInt64, 0).UT C(), ShouldIndex) 104 err = pv.SetValue(time.Unix(math.MaxInt64, 0).UT C(), ShouldIndex)
101 So(err.Error(), ShouldContainSubstring, "time va lue out of range") 105 So(err.Error(), ShouldContainSubstring, "time va lue out of range")
102 So(pv.Value(), ShouldBeNil) 106 So(pv.Value(), ShouldBeNil)
103 So(pv.IndexSetting(), ShouldEqual, ShouldIndex) 107 So(pv.IndexSetting(), ShouldEqual, ShouldIndex)
104 So(pv.Type().String(), ShouldEqual, "PTNull") 108 So(pv.Type().String(), ShouldEqual, "PTNull")
105 }) 109 })
106 Convey("time gets rounded", func() { 110 Convey("time gets rounded", func() {
107 pv := Property{} 111 pv := Property{}
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 178
175 Convey("weird value", func() { 179 Convey("weird value", func() {
176 pm := PropertyMap{} 180 pm := PropertyMap{}
177 err := pm.SetMeta("sup", complex(100, 20 )) 181 err := pm.SetMeta("sup", complex(100, 20 ))
178 So(err.Error(), ShouldContainSubstring, "bad type") 182 So(err.Error(), ShouldContainSubstring, "bad type")
179 }) 183 })
180 }) 184 })
181 }) 185 })
182 }) 186 })
183 } 187 }
OLDNEW
« service/datastore/pls_test.go ('K') | « service/datastore/properties.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698