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

Side by Side Diff: service/datastore/serialize/serialize_test.go

Issue 1550903002: impl/memory: Fix time serialization encoding. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Convert when building the query, not serializing in general. Created 4 years, 11 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
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 serialize 5 package serialize
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "fmt" 9 "fmt"
10 "io" 10 "io"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 if actual.(*ds.Key).Equal(expected[0].(*ds.Key)) { 46 if actual.(*ds.Key).Equal(expected[0].(*ds.Key)) {
47 return "" 47 return ""
48 } 48 }
49 return fmt.Sprintf("Expected: %q\nActual: %q", actual, expected[0]) 49 return fmt.Sprintf("Expected: %q\nActual: %q", actual, expected[0])
50 } 50 }
51 51
52 func TestPropertyMapSerialization(t *testing.T) { 52 func TestPropertyMapSerialization(t *testing.T) {
53 t.Parallel() 53 t.Parallel()
54 54
55 now := time.Now().UTC()
55 tests := []dspmapTC{ 56 tests := []dspmapTC{
56 { 57 {
57 "basic", 58 "basic",
58 ds.PropertyMap{ 59 ds.PropertyMap{
59 "R": {mp(false), mp(2.1), mpNI(3)}, 60 "R": {mp(false), mp(2.1), mpNI(3)},
60 "S": {mp("hello"), mp("world")}, 61 "S": {mp("hello"), mp("world")},
61 }, 62 },
62 }, 63 },
63 { 64 {
64 "keys", 65 "keys",
(...skipping 12 matching lines...) Expand all
77 "data", 78 "data",
78 ds.PropertyMap{ 79 ds.PropertyMap{
79 "S": {mp("sup"), mp("fool"), mp("nerd") }, 80 "S": {mp("sup"), mp("fool"), mp("nerd") },
80 "D.Foo.Nerd": {mp([]byte("sup")), mp([]byte("foo l"))}, 81 "D.Foo.Nerd": {mp([]byte("sup")), mp([]byte("foo l"))},
81 }, 82 },
82 }, 83 },
83 { 84 {
84 "time", 85 "time",
85 ds.PropertyMap{ 86 ds.PropertyMap{
86 "T": { 87 "T": {
87 » » » » » mp(time.Now().UTC()), 88 » » » » » mp(now),
88 » » » » » mp(time.Now().Add(time.Second).UTC())}, 89 » » » » » mp(now.Add(time.Second)),
90 » » » » },
89 }, 91 },
90 }, 92 },
91 { 93 {
92 "empty vals", 94 "empty vals",
93 ds.PropertyMap{ 95 ds.PropertyMap{
94 "T": {mp(true), mp(true)}, 96 "T": {mp(true), mp(true)},
95 "F": {mp(false), mp(false)}, 97 "F": {mp(false), mp(false)},
96 "N": {mp(nil), mp(nil)}, 98 "N": {mp(nil), mp(nil)},
97 "E": {}, 99 "E": {},
98 }, 100 },
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 "__ancestor__": { 507 "__ancestor__": {
506 ToBytes(mp(fakeKey)), 508 ToBytes(mp(fakeKey)),
507 ToBytes(mp(fakeKey.Paren t())), 509 ToBytes(mp(fakeKey.Paren t())),
508 }, 510 },
509 }) 511 })
510 }) 512 })
511 }) 513 })
512 }) 514 })
513 }) 515 })
514 } 516 }
OLDNEW
« impl/memory/datastore_query.go ('K') | « service/datastore/serialize/serialize.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698