| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be 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 "bytes" | 10 "bytes" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 `field "NonSerializableField" has invali
d type: complex64`) | 389 `field "NonSerializableField" has invali
d type: complex64`) |
| 390 }) | 390 }) |
| 391 }) | 391 }) |
| 392 }) | 392 }) |
| 393 } | 393 } |
| 394 | 394 |
| 395 func TestPopulateKey(t *testing.T) { | 395 func TestPopulateKey(t *testing.T) { |
| 396 t.Parallel() | 396 t.Parallel() |
| 397 | 397 |
| 398 Convey("Test PopulateKey", t, func() { | 398 Convey("Test PopulateKey", t, func() { |
| 399 » » k := KeyContext{"app", "namespace"}.NewKey("kind", "", 1337, nil
) | 399 » » k := MkKeyContext("app", "namespace").NewKey("kind", "", 1337, n
il) |
| 400 | 400 |
| 401 Convey("Can set the key of a common struct.", func() { | 401 Convey("Can set the key of a common struct.", func() { |
| 402 var cs CommonStruct | 402 var cs CommonStruct |
| 403 | 403 |
| 404 So(PopulateKey(&cs, k), ShouldBeTrue) | 404 So(PopulateKey(&cs, k), ShouldBeTrue) |
| 405 So(cs.ID, ShouldEqual, 1337) | 405 So(cs.ID, ShouldEqual, 1337) |
| 406 }) | 406 }) |
| 407 | 407 |
| 408 Convey("Will not set the value of a singleton struct.", func() { | 408 Convey("Will not set the value of a singleton struct.", func() { |
| 409 var ss SingletonStruct | 409 var ss SingletonStruct |
| (...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 if err != nil { | 1824 if err != nil { |
| 1825 panic(fmt.Errorf("failed to find absolute path f
or `%s`", sameLevelDir)) | 1825 panic(fmt.Errorf("failed to find absolute path f
or `%s`", sameLevelDir)) |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 ids, err := FindAndParseIndexYAML(abs) | 1828 ids, err := FindAndParseIndexYAML(abs) |
| 1829 So(err, ShouldBeNil) | 1829 So(err, ShouldBeNil) |
| 1830 So(ids[1].Kind, ShouldEqual, "Test Foo") | 1830 So(ids[1].Kind, ShouldEqual, "Test Foo") |
| 1831 }) | 1831 }) |
| 1832 }) | 1832 }) |
| 1833 } | 1833 } |
| OLD | NEW |