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

Unified Diff: impl/memory/gkvlite_iter_test.go

Issue 1521823003: Clean up callback interfaces. (Closed) Base URL: https://github.com/luci/gae.git@extra
Patch Set: fixins 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
« no previous file with comments | « impl/memory/gkvlite_iter.go ('k') | impl/prod/everything_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/gkvlite_iter_test.go
diff --git a/impl/memory/gkvlite_iter_test.go b/impl/memory/gkvlite_iter_test.go
index 1cd33f94cde674b3a75ce917f54fd509e0144818..fe87ac57bd3d63576084ec22284432b6d3db804b 100644
--- a/impl/memory/gkvlite_iter_test.go
+++ b/impl/memory/gkvlite_iter_test.go
@@ -8,6 +8,7 @@ import (
"bytes"
"testing"
+ "github.com/luci/gae/service/datastore"
"github.com/luci/gae/service/datastore/serialize"
"github.com/luci/gkvlite"
"github.com/luci/luci-go/common/cmpbin"
@@ -209,11 +210,11 @@ func TestMultiIteratorSimple(t *testing.T) {
}
i := 1
- multiIterate(defs, func(suffix []byte) bool {
+ So(multiIterate(defs, func(suffix []byte) error {
So(readNum(suffix), ShouldEqual, vals[i][1])
i++
- return true
- })
+ return nil
+ }), ShouldBeNil)
So(i, ShouldEqual, 3)
})
@@ -226,9 +227,9 @@ func TestMultiIteratorSimple(t *testing.T) {
}
i := 0
- multiIterate(defs, func(suffix []byte) bool {
+ So(multiIterate(defs, func(suffix []byte) error {
panic("never")
- })
+ }), ShouldBeNil)
So(i, ShouldEqual, 0)
})
@@ -244,11 +245,11 @@ func TestMultiIteratorSimple(t *testing.T) {
expect := []int64{2, 4}
i := 0
- multiIterate(defs, func(suffix []byte) bool {
+ So(multiIterate(defs, func(suffix []byte) error {
So(readNum(suffix), ShouldEqual, expect[i])
i++
- return true
- })
+ return nil
+ }), ShouldBeNil)
})
Convey("Can stop early", func() {
@@ -258,19 +259,19 @@ func TestMultiIteratorSimple(t *testing.T) {
}
i := 0
- multiIterate(defs, func(suffix []byte) bool {
+ So(multiIterate(defs, func(suffix []byte) error {
So(readNum(suffix), ShouldEqual, vals[i][1])
i++
- return true
- })
+ return nil
+ }), ShouldBeNil)
So(i, ShouldEqual, 5)
i = 0
- multiIterate(defs, func(suffix []byte) bool {
+ So(multiIterate(defs, func(suffix []byte) error {
So(readNum(suffix), ShouldEqual, vals[i][1])
i++
- return false
- })
+ return datastore.Stop
+ }), ShouldBeNil)
So(i, ShouldEqual, 1)
})
« no previous file with comments | « impl/memory/gkvlite_iter.go ('k') | impl/prod/everything_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698