| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 So(pv.Type().String(), ShouldEqual, "PTTime") | 117 So(pv.Type().String(), ShouldEqual, "PTTime") |
| 118 }) | 118 }) |
| 119 Convey("[]byte allows IndexSetting", func() { | 119 Convey("[]byte allows IndexSetting", func() { |
| 120 pv := Property{} | 120 pv := Property{} |
| 121 So(pv.SetValue([]byte("hello"), ShouldIndex), Sh
ouldBeNil) | 121 So(pv.SetValue([]byte("hello"), ShouldIndex), Sh
ouldBeNil) |
| 122 So(pv.Value(), ShouldResemble, []byte("hello")) | 122 So(pv.Value(), ShouldResemble, []byte("hello")) |
| 123 So(pv.IndexSetting(), ShouldEqual, ShouldIndex) | 123 So(pv.IndexSetting(), ShouldEqual, ShouldIndex) |
| 124 So(pv.Type().String(), ShouldEqual, "PTBytes") | 124 So(pv.Type().String(), ShouldEqual, "PTBytes") |
| 125 }) | 125 }) |
| 126 }) | 126 }) |
| 127 |
| 128 Convey("Comparison", func() { |
| 129 Convey(`A []byte property should equal a string property
with the same value.`, func() { |
| 130 a := MkProperty([]byte("ohaithere")) |
| 131 b := MkProperty("ohaithere") |
| 132 So(a.Equal(&b), ShouldBeTrue) |
| 133 }) |
| 134 }) |
| 127 }) | 135 }) |
| 128 } | 136 } |
| 129 | 137 |
| 130 func TestDSPropertyMapImpl(t *testing.T) { | 138 func TestDSPropertyMapImpl(t *testing.T) { |
| 131 t.Parallel() | 139 t.Parallel() |
| 132 | 140 |
| 133 Convey("PropertyMap load/save err conditions", t, func() { | 141 Convey("PropertyMap load/save err conditions", t, func() { |
| 134 Convey("empty", func() { | 142 Convey("empty", func() { |
| 135 pm := PropertyMap{} | 143 pm := PropertyMap{} |
| 136 err := pm.Load(PropertyMap{"hello": {Property{}}}) | 144 err := pm.Load(PropertyMap{"hello": {Property{}}}) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 Convey("errors", func() { | 181 Convey("errors", func() { |
| 174 | 182 |
| 175 Convey("weird value", func() { | 183 Convey("weird value", func() { |
| 176 pm := PropertyMap{} | 184 pm := PropertyMap{} |
| 177 So(pm.SetMeta("sup", complex(100, 20)),
ShouldBeFalse) | 185 So(pm.SetMeta("sup", complex(100, 20)),
ShouldBeFalse) |
| 178 }) | 186 }) |
| 179 }) | 187 }) |
| 180 }) | 188 }) |
| 181 }) | 189 }) |
| 182 } | 190 } |
| OLD | NEW |