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

Unified Diff: service/datastore/properties_test.go

Issue 1576153003: Encode nil datastore keys as PTNull. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Created 4 years, 11 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/properties.go ('k') | service/datastore/serialize/serialize_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/properties_test.go
diff --git a/service/datastore/properties_test.go b/service/datastore/properties_test.go
index 0b797917fa818e1ecec548939cf6acb3d8f5d901..dcde889091af17a18a75ca74c1b0e863b1c77e6d 100644
--- a/service/datastore/properties_test.go
+++ b/service/datastore/properties_test.go
@@ -67,6 +67,19 @@ func TestProperties(t *testing.T) {
So(pv.IndexSetting(), ShouldEqual, ShouldIndex)
So(pv.Type().String(), ShouldEqual, "PTBlobKey")
})
+ Convey("datastore Key is distinguished", func() {
+ k := MakeKey("appid", "ns", "kind", "1")
+ pv := MkProperty(k)
+ So(pv.Value(), ShouldHaveSameTypeAs, k)
+ So(pv.Value().(*Key).Equal(k), ShouldBeTrue)
+ So(pv.IndexSetting(), ShouldEqual, ShouldIndex)
+ So(pv.Type().String(), ShouldEqual, "PTKey")
+
+ pv = MkProperty((*Key)(nil))
+ So(pv.Value(), ShouldBeNil)
+ So(pv.IndexSetting(), ShouldEqual, ShouldIndex)
+ So(pv.Type().String(), ShouldEqual, "PTNull")
+ })
Convey("float", func() {
pv := Property{}
So(pv.SetValue(myfloat(19.7), ShouldIndex), ShouldBeNil)
« no previous file with comments | « service/datastore/properties.go ('k') | service/datastore/serialize/serialize_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698