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

Unified Diff: service/datastore/serialize/serialize_test.go

Issue 1302813003: impl/memory: Implement Queries (Closed) Base URL: https://github.com/luci/gae.git@add_multi_iterator
Patch Set: stringSet everywhere 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/datastore/serialize/serialize.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/serialize/serialize_test.go
diff --git a/service/datastore/serialize/serialize_test.go b/service/datastore/serialize/serialize_test.go
index 168eb7344e5ab94b16f9c17f04ba2dfd80711241..eea4b7ce7555db2156637a67f5b298a914e80446 100644
--- a/service/datastore/serialize/serialize_test.go
+++ b/service/datastore/serialize/serialize_test.go
@@ -164,7 +164,7 @@ func TestSerializationReadMisc(t *testing.T) {
Convey("Property", func() {
buf := mkBuf(nil)
- buf.WriteByte(byte(ds.PTString))
+ buf.WriteByte(0x80 | byte(ds.PTString))
cmpbin.WriteString(buf, "nerp")
So(string(ToBytes(mp("nerp"))),
ShouldEqual, buf.String())
@@ -416,41 +416,37 @@ func TestSerializationReadMisc(t *testing.T) {
Convey("IndexDefinition", func() {
id := ds.IndexDefinition{Kind: "kind"}
- data := ToBytes(id)
- So(string(data), ShouldStartWith, string(ds.IndexBuiltinQueryPrefix()))
+ data := ToBytes(*id.PrepForIdxTable())
newID, err := ReadIndexDefinition(mkBuf(data))
So(err, ShouldBeNil)
- So(newID, ShouldResemble, id)
+ So(newID.Flip(), ShouldResemble, id.Normalize())
id.SortBy = append(id.SortBy, ds.IndexColumn{Property: "prop"})
- data = ToBytes(id)
- So(string(data), ShouldStartWith, string(ds.IndexBuiltinQueryPrefix()))
+ data = ToBytes(*id.PrepForIdxTable())
newID, err = ReadIndexDefinition(mkBuf(data))
So(err, ShouldBeNil)
- So(newID, ShouldResemble, id)
+ So(newID.Flip(), ShouldResemble, id.Normalize())
id.SortBy = append(id.SortBy, ds.IndexColumn{Property: "other", Direction: ds.DESCENDING})
id.Ancestor = true
- data = ToBytes(id)
- So(string(data), ShouldStartWith, string(ds.IndexComplexQueryPrefix()))
+ data = ToBytes(*id.PrepForIdxTable())
newID, err = ReadIndexDefinition(mkBuf(data))
So(err, ShouldBeNil)
- So(newID, ShouldResemble, id)
+ So(newID.Flip(), ShouldResemble, id.Normalize())
// invalid
id.SortBy = append(id.SortBy, ds.IndexColumn{Property: "", Direction: ds.DESCENDING})
- data = ToBytes(id)
- So(string(data), ShouldStartWith, string(ds.IndexComplexQueryPrefix()))
+ data = ToBytes(*id.PrepForIdxTable())
newID, err = ReadIndexDefinition(mkBuf(data))
So(err, ShouldBeNil)
- So(newID, ShouldResemble, id)
+ So(newID.Flip(), ShouldResemble, id.Normalize())
Convey("too many", func() {
id := ds.IndexDefinition{Kind: "wat"}
for i := 0; i < MaxIndexColumns+1; i++ {
id.SortBy = append(id.SortBy, ds.IndexColumn{Property: "Hi", Direction: ds.ASCENDING})
}
- data := ToBytes(id)
+ data := ToBytes(*id.PrepForIdxTable())
newID, err = ReadIndexDefinition(mkBuf(data))
So(err, ShouldErrLike, "over 64 sort orders")
})
« no previous file with comments | « service/datastore/serialize/serialize.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698