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

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

Issue 1365743002: Refactor serialization helpers from impl/memory -> service/datastore/serialize (Closed) Base URL: https://github.com/luci/gae.git@estimate_size
Patch Set: fix comments 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 | « 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 2faae8ba9805611f664aafa1e72b2175648b149a..3dd7127c1c039f2853f434ac9309543fbb1fe42a 100644
--- a/service/datastore/serialize/serialize_test.go
+++ b/service/datastore/serialize/serialize_test.go
@@ -472,3 +472,43 @@ func TestSerializationReadMisc(t *testing.T) {
})
})
}
+
+func TestPartialSerialization(t *testing.T) {
+ t.Parallel()
+
+ fakeKey := mkKey("dev~app", "ns", "parentKind", "sid", "knd", 10)
+
+ Convey("TestPartialSerialization", t, func() {
+ Convey("list", func() {
+ pm := ds.PropertyMap{
+ "wat": {mpNI("thing"), mp("hat"), mp(100)},
+ "nerd": {mp(103.7)},
+ "spaz": {mpNI(false)},
+ }
+ sip := PropertyMapPartially(fakeKey, pm)
+ So(len(sip), ShouldEqual, 4)
+
+ Convey("single collated", func() {
+ Convey("indexableMap", func() {
+ So(sip, ShouldResemble, SerializedPmap{
+ "wat": {
+ ToBytes(mp("hat")),
+ ToBytes(mp(100)),
+ // 'thing' is skipped, because it's not NoIndex
+ },
+ "nerd": {
+ ToBytes(mp(103.7)),
+ },
+ "__key__": {
+ ToBytes(mp(fakeKey)),
+ },
+ "__ancestor__": {
+ ToBytes(mp(fakeKey)),
+ ToBytes(mp(fakeKey.Parent())),
+ },
+ })
+ })
+ })
+ })
+ })
+}
« 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