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

Unified Diff: impl/memory/datastore_query_execution_test.go

Issue 1550903002: impl/memory: Fix time serialization encoding. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Convert when building the query, not serializing in general. Created 5 years 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
Index: impl/memory/datastore_query_execution_test.go
diff --git a/impl/memory/datastore_query_execution_test.go b/impl/memory/datastore_query_execution_test.go
index 2a030b9c2455b075083a39564920f325bb0bb046..c1e64d79a4a5aa3c0b7a258498a62369c27849dc 100644
--- a/impl/memory/datastore_query_execution_test.go
+++ b/impl/memory/datastore_query_execution_test.go
@@ -85,6 +85,15 @@ var stage2Data = []ds.PropertyMap{
),
}
+var timeData = []ds.PropertyMap{
+ pmap("$key", key("Kind", 1), Next,
+ "Date", time.Date(2000, time.January, 1, 1, 1, 1, 1, time.UTC), Next,
+ ),
+ pmap("$key", key("Kind", 2), Next,
+ "Date", time.Date(2000, time.March, 1, 1, 1, 1, 1, time.UTC), Next,
+ ),
+}
+
var queryExecutionTests = []qExTest{
{"basic", []qExStage{
{
@@ -385,6 +394,26 @@ var queryExecutionTests = []qExTest{
},
},
}},
+ {"time range", []qExStage{
+ {
+ addIdxs: []*ds.IndexDefinition{
+ indx("Kind!", "Date"),
+ },
+ },
+ {
+ putEnts: timeData,
+ },
+ {
+ expect: []qExpect{
+ {
+ q: nq("Kind").Lte("Date", time.Date(2000, time.February, 1, 1, 1, 1, 1, time.UTC)),
+ get: []ds.PropertyMap{
+ timeData[0],
+ },
+ },
+ },
+ },
+ }},
}
func TestQueryExecution(t *testing.T) {
@@ -468,7 +497,7 @@ func TestQueryExecution(t *testing.T) {
So(data.GetAll(expect.q, &rslt), ShouldBeNil)
So(len(rslt), ShouldEqual, len(expect.get))
for i, r := range rslt {
- So(r, ShouldResemble, expect.get[i])
+ So(r, ShouldResembleV, expect.get[i])
}
return nil
}, &ds.TransactionOptions{XG: true})

Powered by Google App Engine
This is Rietveld 408576698