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

Side by Side Diff: impl/memory/datastore_query_execution_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 unified diff | Download patch
« no previous file with comments | « impl/memory/datastore_query_execution.go ('k') | impl/memory/datastore_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "fmt" 8 "fmt"
9 "strings" 9 "strings"
10 "testing" 10 "testing"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 }}, 317 }},
318 }, 318 },
319 319
320 extraFns: []func(context.Context){ 320 extraFns: []func(context.Context){
321 func(c context.Context) { 321 func(c context.Context) {
322 data := ds.Get(c) 322 data := ds.Get(c)
323 curs := ds.Cursor(nil) 323 curs := ds.Cursor(nil)
324 324
325 q := nq("").Gt("__key__", key("Kind", 2) ) 325 q := nq("").Gt("__key__", key("Kind", 2) )
326 326
327 » » » » » err := data.Run(q, func(pm ds.PropertyMa p, gc ds.CursorCB) bool { 327 » » » » » err := data.Run(q, func(pm ds.PropertyMa p, gc ds.CursorCB) error {
328 So(pm, ShouldResemble, pmap( 328 So(pm, ShouldResemble, pmap(
329 "$key", key("Kind", 2, " __entity_group__", 1), Next, 329 "$key", key("Kind", 2, " __entity_group__", 1), Next,
330 "__version__", 1)) 330 "__version__", 1))
331 331
332 err := error(nil) 332 err := error(nil)
333 curs, err = gc() 333 curs, err = gc()
334 So(err, ShouldBeNil) 334 So(err, ShouldBeNil)
335 » » » » » » return false 335 » » » » » » return ds.Stop
336 }) 336 })
337 So(err, ShouldBeNil) 337 So(err, ShouldBeNil)
338 338
339 » » » » » err = data.Run(q.Start(curs), func(pm ds .PropertyMap, gc ds.CursorCB) bool { 339 » » » » » err = data.Run(q.Start(curs), func(pm ds .PropertyMap) error {
340 So(pm, ShouldResemble, stage1Dat a[2]) 340 So(pm, ShouldResemble, stage1Dat a[2])
341 » » » » » » return false 341 » » » » » » return ds.Stop
342 }) 342 })
343 So(err, ShouldBeNil) 343 So(err, ShouldBeNil)
344 }, 344 },
345 345
346 func(c context.Context) { 346 func(c context.Context) {
347 data := ds.Get(c) 347 data := ds.Get(c)
348 q := nq("Something").Eq("Does", 2).Order ("Not", "-Work") 348 q := nq("Something").Eq("Does", 2).Order ("Not", "-Work")
349 » » » » » So(data.Run(q, func(ds.Key, ds.CursorCB) bool { 349 » » » » » So(data.Run(q, func(ds.Key) {}), ShouldE rrLike, strings.Join([]string{
350 » » » » » » return true
351 » » » » » }), ShouldErrLike, strings.Join([]string {
352 "Consider adding:", 350 "Consider adding:",
353 "- kind: Something", 351 "- kind: Something",
354 " properties:", 352 " properties:",
355 " - name: Does", 353 " - name: Does",
356 " - name: Not", 354 " - name: Not",
357 " - name: Work", 355 " - name: Work",
358 " direction: desc", 356 " direction: desc",
359 }, "\n")) 357 }, "\n"))
360 }, 358 },
361 359
362 func(c context.Context) { 360 func(c context.Context) {
363 data := ds.Get(c) 361 data := ds.Get(c)
364 q := nq("Something").Ancestor(key("Kind" , 3)).Order("Val") 362 q := nq("Something").Ancestor(key("Kind" , 3)).Order("Val")
365 » » » » » So(data.Run(q, func(ds.Key, ds.CursorCB) bool { 363 » » » » » So(data.Run(q, func(ds.Key) {}), ShouldE rrLike, strings.Join([]string{
366 » » » » » » return true
367 » » » » » }), ShouldErrLike, strings.Join([]string {
368 "Consider adding:", 364 "Consider adding:",
369 "- kind: Something", 365 "- kind: Something",
370 " ancestor: yes", 366 " ancestor: yes",
371 " properties:", 367 " properties:",
372 " - name: Val", 368 " - name: Val",
373 }, "\n")) 369 }, "\n"))
374 }, 370 },
375 }, 371 },
376 }, 372 },
377 373
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 count, err := data.Count(q) 513 count, err := data.Count(q)
518 So(err, ShouldErrLike, "Insufficient indexes") 514 So(err, ShouldErrLike, "Insufficient indexes")
519 515
520 testing.AutoIndex(true) 516 testing.AutoIndex(true)
521 517
522 count, err = data.Count(q) 518 count, err = data.Count(q)
523 So(err, ShouldBeNil) 519 So(err, ShouldBeNil)
524 So(count, ShouldEqual, 2) 520 So(count, ShouldEqual, 2)
525 }) 521 })
526 } 522 }
OLDNEW
« no previous file with comments | « impl/memory/datastore_query_execution.go ('k') | impl/memory/datastore_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698