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

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

Issue 1530503003: Return error on Get(*Key). (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 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 | « service/datastore/datastore.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 // adapted from github.com/golang/appengine/datastore 5 // adapted from github.com/golang/appengine/datastore
6 6
7 package datastore 7 package datastore
8 8
9 import ( 9 import (
10 "fmt" 10 "fmt"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 Convey("get multi error for individual failures", func() { 403 Convey("get multi error for individual failures", func() {
404 fplss := []FakePLS{{}, {Kind: "Fail"}} 404 fplss := []FakePLS{{}, {Kind: "Fail"}}
405 So(ds.PutMulti(fplss), ShouldResemble, errors.Mu ltiError{nil, errors.New("PutMulti fail")}) 405 So(ds.PutMulti(fplss), ShouldResemble, errors.Mu ltiError{nil, errors.New("PutMulti fail")})
406 }) 406 })
407 407
408 Convey("put with non-modifyable type is an error", func( ) { 408 Convey("put with non-modifyable type is an error", func( ) {
409 cs := CommonStruct{} 409 cs := CommonStruct{}
410 So(ds.Put(cs), ShouldErrLike, "invalid Put input type") 410 So(ds.Put(cs), ShouldErrLike, "invalid Put input type")
411 }) 411 })
412 412
413 Convey("get with *Key is an error", func() {
414 So(ds.Get(&Key{}), ShouldErrLike, "invalid Get i nput type: *datastore.Key")
415 })
416
413 Convey("struct with no $kind is an error", func() { 417 Convey("struct with no $kind is an error", func() {
414 s := MGSWithNoKind{} 418 s := MGSWithNoKind{}
415 So(ds.Put(&s), ShouldErrLike, "unable to extract $kind") 419 So(ds.Put(&s), ShouldErrLike, "unable to extract $kind")
416 }) 420 })
417 }) 421 })
418 422
419 Convey("ok", func() { 423 Convey("ok", func() {
420 Convey("[]S", func() { 424 Convey("[]S", func() {
421 css := make([]CommonStruct, 7) 425 css := make([]CommonStruct, 7)
422 for i := range css { 426 for i := range css {
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 Convey("extra field with bad type", func() { 1257 Convey("extra field with bad type", func() {
1254 type Bad struct { 1258 type Bad struct {
1255 A int64 `gae:",extra"` 1259 A int64 `gae:",extra"`
1256 } 1260 }
1257 So(func() { GetPLS(&Bad{}) }, ShouldPanicLike, 1261 So(func() { GetPLS(&Bad{}) }, ShouldPanicLike,
1258 "struct 'extra' field has invalid type i nt64") 1262 "struct 'extra' field has invalid type i nt64")
1259 }) 1263 })
1260 }) 1264 })
1261 }) 1265 })
1262 } 1266 }
OLDNEW
« no previous file with comments | « service/datastore/datastore.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698