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

Unified Diff: impl/prod/raw_datastore_type_converter_test.go

Issue 1345043005: Fix zero time bug (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/prod/raw_datastore_type_converter.go ('k') | service/datastore/properties.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/prod/raw_datastore_type_converter_test.go
diff --git a/impl/prod/raw_datastore_type_converter_test.go b/impl/prod/raw_datastore_type_converter_test.go
index 02549842b8c7b5c7190561b73305d1e29280b4e4..357bbd5952f93767dd0ec8ad0527fcbb5fc942bd 100644
--- a/impl/prod/raw_datastore_type_converter_test.go
+++ b/impl/prod/raw_datastore_type_converter_test.go
@@ -127,7 +127,10 @@ func TestBasicDatastore(t *testing.T) {
// time comparisons in Go are wonky, so this is pulled out
pm := dstore.PropertyMap{
"$key": {mpNI(ds.NewKey("Something", "value", 0, nil))},
- "Time": {mp(time.Date(1938, time.January, 1, 1, 1, 1, 1, time.UTC))},
+ "Time": {
+ mp(time.Date(1938, time.January, 1, 1, 1, 1, 1, time.UTC)),
+ mp(time.Time{}),
+ },
}
So(ds.Put(&pm), ShouldBeNil)
@@ -140,13 +143,23 @@ func TestBasicDatastore(t *testing.T) {
q := dstore.NewQuery("Something").Project("Time")
all := []dstore.PropertyMap{}
So(ds.GetAll(q, &all), ShouldBeNil)
- So(len(all), ShouldEqual, 1)
+ So(len(all), ShouldEqual, 2)
prop := all[0]["Time"][0]
So(prop.Type(), ShouldEqual, dstore.PTInt)
tval, err := prop.Project(dstore.PTTime)
So(err, ShouldBeNil)
+ So(tval, ShouldResemble, time.Time{})
+
+ tval, err = all[1]["Time"][0].Project(dstore.PTTime)
+ So(err, ShouldBeNil)
So(tval, ShouldResemble, pm["Time"][0].Value())
+
+ ent := dstore.PropertyMap{
+ "$key": {mpNI(ds.MakeKey("Something", "value"))},
+ }
+ So(ds.Get(&ent), ShouldBeNil)
+ So(ent["Time"], ShouldResemble, pm["Time"])
})
})
}
« no previous file with comments | « impl/prod/raw_datastore_type_converter.go ('k') | service/datastore/properties.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698