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 package serialize | 5 package serialize |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "io" | 10 "io" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 type dspmapTC struct { | 31 type dspmapTC struct { |
32 name string | 32 name string |
33 props ds.PropertyMap | 33 props ds.PropertyMap |
34 } | 34 } |
35 | 35 |
36 func mkKey(appID, namespace string, elems ...interface{}) *ds.Key { | 36 func mkKey(appID, namespace string, elems ...interface{}) *ds.Key { |
37 return ds.MkKeyContext(appID, namespace).MakeKey(elems...) | 37 return ds.MkKeyContext(appID, namespace).MakeKey(elems...) |
38 } | 38 } |
39 | 39 |
40 func mkBuf(data []byte) Buffer { | 40 func mkBuf(data []byte) WriteBuffer { |
41 return Invertible(bytes.NewBuffer(data)) | 41 return Invertible(bytes.NewBuffer(data)) |
42 } | 42 } |
43 | 43 |
44 // TODO(riannucci): dedup with datastore/key testing file | 44 // TODO(riannucci): dedup with datastore/key testing file |
45 func ShouldEqualKey(actual interface{}, expected ...interface{}) string { | 45 func ShouldEqualKey(actual interface{}, expected ...interface{}) string { |
46 if len(expected) != 1 { | 46 if len(expected) != 1 { |
47 return fmt.Sprintf("Assertion requires 1 expected value, got %d"
, len(expected)) | 47 return fmt.Sprintf("Assertion requires 1 expected value, got %d"
, len(expected)) |
48 } | 48 } |
49 if actual.(*ds.Key).Equal(expected[0].(*ds.Key)) { | 49 if actual.(*ds.Key).Equal(expected[0].(*ds.Key)) { |
50 return "" | 50 return "" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 "__ancestor__": { | 509 "__ancestor__": { |
510 ToBytes(mp(fakeKey)), | 510 ToBytes(mp(fakeKey)), |
511 ToBytes(mp(fakeKey.Paren
t())), | 511 ToBytes(mp(fakeKey.Paren
t())), |
512 }, | 512 }, |
513 }) | 513 }) |
514 }) | 514 }) |
515 }) | 515 }) |
516 }) | 516 }) |
517 }) | 517 }) |
518 } | 518 } |
OLD | NEW |