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 package datastore | 5 package datastore |
6 | 6 |
7 import ( | 7 import ( |
8 "math" | 8 "math" |
9 "testing" | 9 "testing" |
10 "time" | 10 "time" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 So(pv.Value(), ShouldEqual, "sup") | 60 So(pv.Value(), ShouldEqual, "sup") |
61 So(pv.IndexSetting(), ShouldEqual, Shoul
dIndex) | 61 So(pv.IndexSetting(), ShouldEqual, Shoul
dIndex) |
62 So(pv.Type().String(), ShouldEqual, "PTS
tring") | 62 So(pv.Type().String(), ShouldEqual, "PTS
tring") |
63 }) | 63 }) |
64 Convey("blobstore.Key is distinquished", func()
{ | 64 Convey("blobstore.Key is distinquished", func()
{ |
65 pv := MkProperty(blobstore.Key("sup")) | 65 pv := MkProperty(blobstore.Key("sup")) |
66 So(pv.Value(), ShouldEqual, blobstore.Ke
y("sup")) | 66 So(pv.Value(), ShouldEqual, blobstore.Ke
y("sup")) |
67 So(pv.IndexSetting(), ShouldEqual, Shoul
dIndex) | 67 So(pv.IndexSetting(), ShouldEqual, Shoul
dIndex) |
68 So(pv.Type().String(), ShouldEqual, "PTB
lobKey") | 68 So(pv.Type().String(), ShouldEqual, "PTB
lobKey") |
69 }) | 69 }) |
| 70 Convey("datastore Key is distinguished", func()
{ |
| 71 k := MakeKey("appid", "ns", "kind", "1") |
| 72 pv := MkProperty(k) |
| 73 So(pv.Value(), ShouldHaveSameTypeAs, k) |
| 74 So(pv.Value().(*Key).Equal(k), ShouldBeT
rue) |
| 75 So(pv.IndexSetting(), ShouldEqual, Shoul
dIndex) |
| 76 So(pv.Type().String(), ShouldEqual, "PTK
ey") |
| 77 |
| 78 pv = MkProperty((*Key)(nil)) |
| 79 So(pv.Value(), ShouldBeNil) |
| 80 So(pv.IndexSetting(), ShouldEqual, Shoul
dIndex) |
| 81 So(pv.Type().String(), ShouldEqual, "PTN
ull") |
| 82 }) |
70 Convey("float", func() { | 83 Convey("float", func() { |
71 pv := Property{} | 84 pv := Property{} |
72 So(pv.SetValue(myfloat(19.7), ShouldInde
x), ShouldBeNil) | 85 So(pv.SetValue(myfloat(19.7), ShouldInde
x), ShouldBeNil) |
73 So(pv.Value(), ShouldHaveSameTypeAs, flo
at64(19.7)) | 86 So(pv.Value(), ShouldHaveSameTypeAs, flo
at64(19.7)) |
74 So(pv.Value(), ShouldEqual, float32(19.7
)) | 87 So(pv.Value(), ShouldEqual, float32(19.7
)) |
75 So(pv.IndexSetting(), ShouldEqual, Shoul
dIndex) | 88 So(pv.IndexSetting(), ShouldEqual, Shoul
dIndex) |
76 So(pv.Type().String(), ShouldEqual, "PTF
loat") | 89 So(pv.Type().String(), ShouldEqual, "PTF
loat") |
77 }) | 90 }) |
78 }) | 91 }) |
79 Convey("bad type", func() { | 92 Convey("bad type", func() { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 Convey("errors", func() { | 211 Convey("errors", func() { |
199 | 212 |
200 Convey("weird value", func() { | 213 Convey("weird value", func() { |
201 pm := PropertyMap{} | 214 pm := PropertyMap{} |
202 So(pm.SetMeta("sup", complex(100, 20)),
ShouldBeFalse) | 215 So(pm.SetMeta("sup", complex(100, 20)),
ShouldBeFalse) |
203 }) | 216 }) |
204 }) | 217 }) |
205 }) | 218 }) |
206 }) | 219 }) |
207 } | 220 } |
OLD | NEW |