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

Unified Diff: service/datastore/index_test.go

Issue 1292913002: Split off serialization and key functions to their own packages. (Closed) Base URL: https://github.com/luci/gae.git@make_queries_better
Patch Set: rebase 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/index.go ('k') | service/datastore/invertible.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/index_test.go
diff --git a/service/datastore/index_test.go b/service/datastore/index_test.go
index 2667534c791f2401fe334f5ba0427824d042c36e..6d910e649321cc2c079ac7dc6884359287aa7788 100644
--- a/service/datastore/index_test.go
+++ b/service/datastore/index_test.go
@@ -7,7 +7,6 @@
package datastore
import (
- "bytes"
"testing"
. "github.com/smartystreets/goconvey/convey"
@@ -41,52 +40,5 @@ func TestIndexDefinition(t *testing.T) {
So(id.Builtin(), ShouldBeFalse)
So(id.Compound(), ShouldBeFalse)
})
-
- Convey("binary", func() {
- id := IndexDefinition{Kind: "kind"}
- buf := &bytes.Buffer{}
- So(id.Write(buf), ShouldBeNil)
- So(bytes.HasPrefix(buf.Bytes(), IndexBuiltinQueryPrefix()), ShouldBeTrue)
- newId := IndexDefinition{}
- So(newId.Read(buf), ShouldBeNil)
- So(newId, ShouldResemble, id)
-
- id.SortBy = append(id.SortBy, IndexColumn{Property: "prop"})
- buf = &bytes.Buffer{}
- So(id.Write(buf), ShouldBeNil)
- So(bytes.HasPrefix(buf.Bytes(), IndexBuiltinQueryPrefix()), ShouldBeTrue)
- newId = IndexDefinition{}
- So(newId.Read(buf), ShouldBeNil)
- So(newId, ShouldResemble, id)
-
- id.SortBy = append(id.SortBy, IndexColumn{"other", DESCENDING})
- id.Ancestor = true
- buf = &bytes.Buffer{}
- So(id.Write(buf), ShouldBeNil)
- So(bytes.HasPrefix(buf.Bytes(), IndexComplexQueryPrefix()), ShouldBeTrue)
- newId = IndexDefinition{}
- So(newId.Read(buf), ShouldBeNil)
- So(newId, ShouldResemble, id)
-
- // invalid
- id.SortBy = append(id.SortBy, IndexColumn{"", DESCENDING})
- buf = &bytes.Buffer{}
- So(id.Write(buf), ShouldBeNil)
- So(bytes.HasPrefix(buf.Bytes(), IndexComplexQueryPrefix()), ShouldBeTrue)
- newId = IndexDefinition{}
- So(newId.Read(buf), ShouldBeNil)
- So(newId, ShouldResemble, id)
- })
-
- Convey("too many", func() {
- id := IndexDefinition{Kind: "wat"}
- for i := 0; i < MaxIndexColumns+1; i++ {
- id.SortBy = append(id.SortBy, IndexColumn{"Hi", ASCENDING})
- }
- buf := &bytes.Buffer{}
- So(id.Write(buf), ShouldBeNil)
- newId := IndexDefinition{}
- So(newId.Read(buf).Error(), ShouldContainSubstring, "over 64 sort orders")
- })
})
}
« no previous file with comments | « service/datastore/index.go ('k') | service/datastore/invertible.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698