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

Unified Diff: service/datastore/raw_interface_test.go

Issue 1516173002: Fix error message from KeyForObj when passing an invalid struct. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: remove accidental extra test 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
« service/datastore/pls.go ('K') | « service/datastore/raw_interface.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/raw_interface_test.go
diff --git a/service/datastore/raw_interface_test.go b/service/datastore/raw_interface_test.go
index 475d16af72ea34f71b8cd5eb6e8db19fe29b5c42..b106c4943d18b666a5cf4116cb52cbadd7a2c298 100644
--- a/service/datastore/raw_interface_test.go
+++ b/service/datastore/raw_interface_test.go
@@ -16,36 +16,37 @@ func TestMultiMetaGetter(t *testing.T) {
Convey("Test MultiMetaGetter", t, func() {
Convey("nil", func() {
mmg := NewMultiMetaGetter(nil)
- val, err := mmg.GetMeta(7, "hi")
- So(err, ShouldEqual, ErrMetaFieldUnset)
+ val, ok := mmg.GetMeta(7, "hi")
+ So(ok, ShouldBeFalse)
So(val, ShouldBeNil)
- So(mmg.GetMetaDefault(7, "hi", "value"), ShouldEqual, "value")
+ So(GetMetaDefault(mmg.GetSingle(7), "hi", "value"), ShouldEqual, "value")
m := mmg.GetSingle(10)
- val, err = m.GetMeta("hi")
- So(err, ShouldEqual, ErrMetaFieldUnset)
+ val, ok = m.GetMeta("hi")
+ So(ok, ShouldBeFalse)
So(val, ShouldBeNil)
- So(m.GetMetaDefault("hi", "value"), ShouldEqual, "value")
+
+ So(GetMetaDefault(m, "hi", "value"), ShouldEqual, "value")
})
Convey("stuff", func() {
pmaps := []PropertyMap{{}, nil, {}}
- So(pmaps[0].SetMeta("hi", "thing"), ShouldBeNil)
- So(pmaps[2].SetMeta("key", 100), ShouldBeNil)
+ So(pmaps[0].SetMeta("hi", "thing"), ShouldBeTrue)
+ So(pmaps[2].SetMeta("key", 100), ShouldBeTrue)
mmg := NewMultiMetaGetter(pmaps)
// oob is OK
- So(mmg.GetMetaDefault(7, "hi", "value"), ShouldEqual, "value")
+ So(GetMetaDefault(mmg.GetSingle(7), "hi", "value"), ShouldEqual, "value")
// nil is OK
- So(mmg.GetMetaDefault(1, "key", true), ShouldEqual, true)
+ So(GetMetaDefault(mmg.GetSingle(1), "key", true), ShouldEqual, true)
- val, err := mmg.GetMeta(0, "hi")
- So(err, ShouldBeNil)
+ val, ok := mmg.GetMeta(0, "hi")
+ So(ok, ShouldBeTrue)
So(val, ShouldEqual, "thing")
- So(mmg.GetMetaDefault(2, "key", 20), ShouldEqual, 100)
+ So(GetMetaDefault(mmg.GetSingle(2), "key", 20), ShouldEqual, 100)
})
})
}
« service/datastore/pls.go ('K') | « service/datastore/raw_interface.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698