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

Side by Side Diff: service/datastore/query_test.go

Issue 1409613002: Use the sort.Search api correctly. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Created 5 years, 2 months 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
« service/datastore/query.go ('K') | « service/datastore/query.go ('k') | no next file » | 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 datastore 5 package datastore
6 6
7 import ( 7 import (
8 "math" 8 "math"
9 "testing" 9 "testing"
10 10
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 nq().Order("a", "b", "c").Eq("b", 2, 2), 246 nq().Order("a", "b", "c").Eq("b", 2, 2),
247 "SELECT * FROM `Foo` WHERE `b` = 2 ORDER BY `a`, `c`, `__key__`" , 247 "SELECT * FROM `Foo` WHERE `b` = 2 ORDER BY `a`, `c`, `__key__`" ,
248 nil, nq().Order("a", "c").Eq("b", 2)}, 248 nil, nq().Order("a", "c").Eq("b", 2)},
249 249
250 {"sort orders used for equality are ignored (reversed)", 250 {"sort orders used for equality are ignored (reversed)",
251 nq().Eq("b", 2).Order("a", "b", "c"), 251 nq().Eq("b", 2).Order("a", "b", "c"),
252 "SELECT * FROM `Foo` WHERE `b` = 2 ORDER BY `a`, `c`, `__key__`" , 252 "SELECT * FROM `Foo` WHERE `b` = 2 ORDER BY `a`, `c`, `__key__`" ,
253 nil, 253 nil,
254 nq().Order("a", "c").Eq("b", 2)}, 254 nq().Order("a", "c").Eq("b", 2)},
255 255
256 {"duplicate equality filters are ignored",
257 nq().Eq("b", 10, -1, 2, 2, 7, 1, 2, 10, -1, 7, 1, 2),
258 "SELECT * FROM `Foo` WHERE `b` = -1 AND `b` = 1 AND `b` = 2 AND `b` = 7 AND `b` = 10 ORDER BY `__key__`",
259 nil,
260 nq().Eq("b", -1, 1, 2, 7, 10)},
261
256 {"duplicate orders are ignored", 262 {"duplicate orders are ignored",
257 nq().Order("a").Order("a").Order("a"), 263 nq().Order("a").Order("a").Order("a"),
258 "SELECT * FROM `Foo` ORDER BY `a`, `__key__`", 264 "SELECT * FROM `Foo` ORDER BY `a`, `__key__`",
259 nil, 265 nil,
260 nq().Order("a")}, 266 nq().Order("a")},
261 267
262 {"Filtering on a reserved property is forbidden", 268 {"Filtering on a reserved property is forbidden",
263 nq().Gte("__special__", 10), 269 nq().Gte("__special__", 10),
264 "", 270 "",
265 "cannot filter/project on reserved property: \"__special__\"", 271 "cannot filter/project on reserved property: \"__special__\"",
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 So(err, ShouldBeNil) 328 So(err, ShouldBeNil)
323 329
324 fq.original = nil 330 fq.original = nil
325 fq2.original = nil 331 fq2.original = nil
326 So(fq, ShouldResemble, fq2) 332 So(fq, ShouldResemble, fq2)
327 } 333 }
328 }) 334 })
329 } 335 }
330 }) 336 })
331 } 337 }
OLDNEW
« service/datastore/query.go ('K') | « service/datastore/query.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698