| Index: impl/memory/datastore_test.go
|
| diff --git a/impl/memory/datastore_test.go b/impl/memory/datastore_test.go
|
| index 73a3dd50fbc9b59e36f0e0bb3ff5645a25e9adb9..9eb4e286f57bf315b3e8ee8d64fd6208725a0f4c 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,24 @@ func TestCompoundIndexes(t *testing.T) {
|
| So(numItms(coll), ShouldEqual, 4)
|
| })
|
| }
|
| +
|
| +// High level test for regression in how zero time is stored,
|
| +// see https://codereview.chromium.org/1334043003/
|
| +func TestDefaultTimeField(t *testing.T) {
|
| + 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().UTC()
|
| + So(ds.Get(&m), ShouldBeNil)
|
| + So(m.Time.IsZero(), ShouldBeTrue)
|
| + })
|
| +}
|
|
|