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 // 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 Loading... |
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 Loading... |
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 } |
OLD | NEW |