Index: service/datastore/properties_test.go |
diff --git a/service/datastore/properties_test.go b/service/datastore/properties_test.go |
index 2dc8851fd3f3e8156feeb4b34a18d3b2e10e881c..0b797917fa818e1ecec548939cf6acb3d8f5d901 100644 |
--- a/service/datastore/properties_test.go |
+++ b/service/datastore/properties_test.go |
@@ -116,6 +116,23 @@ func TestProperties(t *testing.T) { |
So(pv.IndexSetting(), ShouldEqual, ShouldIndex) |
So(pv.Type().String(), ShouldEqual, "PTTime") |
}) |
+ Convey("zero time", func() { |
+ now := time.Time{} |
+ So(now.IsZero(), ShouldBeTrue) |
+ |
+ pv := Property{} |
+ So(pv.SetValue(now, ShouldIndex), ShouldBeNil) |
+ So(pv.Value(), ShouldResemble, now) |
+ v, err := pv.Project(PTInt) |
+ So(err, ShouldBeNil) |
+ So(v, ShouldEqual, 0) |
+ |
+ So(pv.SetValue(0, ShouldIndex), ShouldBeNil) |
+ So(pv.Value(), ShouldEqual, 0) |
+ v, err = pv.Project(PTTime) |
+ So(err, ShouldBeNil) |
+ So(v.(time.Time).IsZero(), ShouldBeTrue) |
+ }) |
Convey("[]byte allows IndexSetting", func() { |
pv := Property{} |
So(pv.SetValue([]byte("hello"), ShouldIndex), ShouldBeNil) |
@@ -124,6 +141,14 @@ func TestProperties(t *testing.T) { |
So(pv.Type().String(), ShouldEqual, "PTBytes") |
}) |
}) |
+ |
+ Convey("Comparison", func() { |
+ Convey(`A []byte property should equal a string property with the same value.`, func() { |
+ a := MkProperty([]byte("ohaithere")) |
+ b := MkProperty("ohaithere") |
+ So(a.Equal(&b), ShouldBeTrue) |
+ }) |
+ }) |
}) |
} |