Index: impl/memory/datastore_test.go |
diff --git a/impl/memory/datastore_test.go b/impl/memory/datastore_test.go |
index 73a3dd50fbc9b59e36f0e0bb3ff5645a25e9adb9..1736e4bb5e1bc3254854ea3b2131a492408003e9 100644 |
--- a/impl/memory/datastore_test.go |
+++ b/impl/memory/datastore_test.go |
@@ -7,6 +7,7 @@ package memory |
import ( |
"fmt" |
"testing" |
+ "time" |
dsS "github.com/luci/gae/service/datastore" |
"github.com/luci/gae/service/datastore/dskey" |
@@ -530,3 +531,22 @@ func TestCompoundIndexes(t *testing.T) { |
So(numItms(coll), ShouldEqual, 4) |
}) |
} |
+ |
+func TestDefaultTimeField(t *testing.T) { |
iannucci
2015/09/15 02:35:06
this is fine, but probably add a link to this CL o
Vadim Sh.
2015/09/15 03:01:00
Done.
|
+ t.Parallel() |
+ |
+ Convey("Default time.Time{} can be stored", t, func() { |
+ type Model struct { |
+ ID int64 `gae:"$id"` |
+ Time time.Time |
+ } |
+ ds := dsS.Get(Use(context.Background())) |
+ m := Model{ID: 1} |
+ So(ds.Put(&m), ShouldBeNil) |
+ |
+ // Reset to something non zero to ensure zero is fetched. |
+ m.Time = time.Now() |
+ So(ds.Get(&m), ShouldBeNil) |
+ So(m.Time.IsZero(), ShouldBeTrue) |
+ }) |
+} |