OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package memory | 5 package memory |
6 | 6 |
7 import ( | 7 import ( |
8 "sort" | 8 "sort" |
9 "testing" | 9 "testing" |
10 "time" | 10 "time" |
11 | 11 |
12 ds "github.com/luci/gae/service/datastore" | 12 ds "github.com/luci/gae/service/datastore" |
13 "github.com/luci/gkvlite" | 13 "github.com/luci/gkvlite" |
14 . "github.com/smartystreets/goconvey/convey" | 14 . "github.com/smartystreets/goconvey/convey" |
15 ) | 15 ) |
16 | 16 |
17 var fakeKey = key("knd", 10, key("parentKind", "sid")) | 17 var fakeKey = key("parentKind", "sid", "knd", 10) |
18 | 18 |
19 func TestCollated(t *testing.T) { | 19 func TestCollated(t *testing.T) { |
20 t.Parallel() | 20 t.Parallel() |
21 | 21 |
22 Convey("TestCollated", t, func() { | 22 Convey("TestCollated", t, func() { |
23 Convey("nil list", func() { | 23 Convey("nil list", func() { |
24 pm := ds.PropertyMap(nil) | 24 pm := ds.PropertyMap(nil) |
25 sip := partiallySerialize(fakeKey, pm) | 25 sip := partiallySerialize(fakeKey, pm) |
26 | 26 |
27 Convey("nil collated", func() { | 27 Convey("nil collated", func() { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 return true | 289 return true |
290 }) | 290 }) |
291 So(i, ShouldEqual, len(vals)) | 291 So(i, ShouldEqual, len(vals)) |
292 } | 292 } |
293 }) | 293 }) |
294 } | 294 } |
295 }) | 295 }) |
296 } | 296 } |
297 | 297 |
298 type dumbItem struct { | 298 type dumbItem struct { |
299 » key ds.Key | 299 » key *ds.Key |
300 props ds.PropertyMap | 300 props ds.PropertyMap |
301 } | 301 } |
302 | 302 |
303 var updateIndexesTests = []struct { | 303 var updateIndexesTests = []struct { |
304 name string | 304 name string |
305 idxs []*ds.IndexDefinition | 305 idxs []*ds.IndexDefinition |
306 data []dumbItem | 306 data []dumbItem |
307 expected map[string][][]byte | 307 expected map[string][][]byte |
308 }{ | 308 }{ |
309 | 309 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 So(data[i], ShouldResemble, itm.
Key) | 404 So(data[i], ShouldResemble, itm.
Key) |
405 i++ | 405 i++ |
406 return true | 406 return true |
407 }) | 407 }) |
408 So(i, ShouldEqual, len(data)) | 408 So(i, ShouldEqual, len(data)) |
409 } | 409 } |
410 }) | 410 }) |
411 } | 411 } |
412 }) | 412 }) |
413 } | 413 } |
OLD | NEW |