| Index: impl/memory/datastore_test.go
|
| diff --git a/impl/memory/datastore_test.go b/impl/memory/datastore_test.go
|
| index c604991159b633d75954698458516370256a3c7a..210e676b95d1ad065775f59bda2ac534c2b0242f 100644
|
| --- a/impl/memory/datastore_test.go
|
| +++ b/impl/memory/datastore_test.go
|
| @@ -457,6 +457,47 @@ func TestDatastoreSingleReadWriter(t *testing.T) {
|
| })
|
| })
|
| })
|
| +
|
| + Convey("Testable.Consistent", func() {
|
| + Convey("false", func() {
|
| + ds.Testable().Consistent(false) // the default
|
| + for i := 0; i < 10; i++ {
|
| + So(ds.Put(&Foo{ID: int64(i + 1), Val: i + 1}), ShouldBeNil)
|
| + }
|
| + q := dsS.NewQuery("Foo").Gt("Val", 3)
|
| + count, err := ds.Count(q)
|
| + So(err, ShouldBeNil)
|
| + So(count, ShouldEqual, 0)
|
| +
|
| + ds.Delete(ds.MakeKey("Foo", 4))
|
| +
|
| + count, err = ds.Count(q)
|
| + So(err, ShouldBeNil)
|
| + So(count, ShouldEqual, 0)
|
| +
|
| + ds.Testable().Consistent(true)
|
| + count, err = ds.Count(q)
|
| + So(err, ShouldBeNil)
|
| + So(count, ShouldEqual, 6)
|
| + })
|
| +
|
| + Convey("true", func() {
|
| + ds.Testable().Consistent(true)
|
| + for i := 0; i < 10; i++ {
|
| + So(ds.Put(&Foo{ID: int64(i + 1), Val: i + 1}), ShouldBeNil)
|
| + }
|
| + q := dsS.NewQuery("Foo").Gt("Val", 3)
|
| + count, err := ds.Count(q)
|
| + So(err, ShouldBeNil)
|
| + So(count, ShouldEqual, 7)
|
| +
|
| + ds.Delete(ds.MakeKey("Foo", 4))
|
| +
|
| + count, err = ds.Count(q)
|
| + So(err, ShouldBeNil)
|
| + So(count, ShouldEqual, 6)
|
| + })
|
| + })
|
| })
|
| }
|
|
|
|
|