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

Unified Diff: impl/prod/everything_test.go

Issue 1745703002: Auto-project on distinct inequality fields. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Group similar logics. Created 4 years, 10 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 | « no previous file | service/datastore/query.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/prod/everything_test.go
diff --git a/impl/prod/everything_test.go b/impl/prod/everything_test.go
index 867c6d72dbc6e5f693e109cfc90983b67f9087d6..66a372d0c419d26b3ef72112abe778e098be1ca0 100644
--- a/impl/prod/everything_test.go
+++ b/impl/prod/everything_test.go
@@ -182,6 +182,36 @@ func TestBasicDatastore(t *testing.T) {
count, err := ds.Count(q)
So(err, ShouldBeNil)
So(count, ShouldEqual, 4)
+
+ q = datastore.NewQuery("TestStruct").Lte("ValueI", 7).Project("ValueS").Distinct(true)
+ rslts = []datastore.PropertyMap{}
+ So(ds.GetAll(q, &rslts), ShouldBeNil)
+ So(rslts, ShouldResemble, []datastore.PropertyMap{
+ {
+ "$key": {mpNI(ds.KeyForObj(&orig))},
+ "ValueI": {mp(1)},
+ "ValueS": {mp("hello")},
+ },
+ {
+ "$key": {mpNI(ds.KeyForObj(&orig))},
+ "ValueI": {mp(1)},
+ "ValueS": {mp("world")},
+ },
+ {
+ "$key": {mpNI(ds.KeyForObj(&orig))},
+ "ValueI": {mp(7)},
+ "ValueS": {mp("hello")},
+ },
+ {
+ "$key": {mpNI(ds.KeyForObj(&orig))},
+ "ValueI": {mp(7)},
+ "ValueS": {mp("world")},
+ },
+ })
+
+ count, err = ds.Count(q)
+ So(err, ShouldBeNil)
+ So(count, ShouldEqual, 4)
})
})
@@ -211,7 +241,7 @@ func TestBasicDatastore(t *testing.T) {
tval, err := prop.Project(datastore.PTTime)
So(err, ShouldBeNil)
- So(tval, ShouldResemble, time.Time{})
+ So(tval, ShouldResemble, time.Time{}.UTC())
tval, err = all[1]["Time"][0].Project(datastore.PTTime)
So(err, ShouldBeNil)
« no previous file with comments | « no previous file | service/datastore/query.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698