Refactor struct's time to remove unnecessary memory usage (#3142)

* refactor struct's time to remove unnecessary memory usage

* use AsTimePtr simple code

* fix tests

* fix time compare

* fix template on gpg

* use AddDuration instead of Add
This commit is contained in:
Lunny Xiao 2017-12-11 12:37:04 +08:00 committed by Lauris BH
parent c082c3bce3
commit f2e20c81b6
67 changed files with 334 additions and 479 deletions

View file

@ -33,9 +33,9 @@ func TestCreateComment(t *testing.T) {
assert.EqualValues(t, "Hello", comment.Content)
assert.EqualValues(t, issue.ID, comment.IssueID)
assert.EqualValues(t, doer.ID, comment.PosterID)
AssertInt64InRange(t, now, then, comment.CreatedUnix)
AssertInt64InRange(t, now, then, int64(comment.CreatedUnix))
AssertExistsAndLoadBean(t, comment) // assert actually added to DB
updatedIssue := AssertExistsAndLoadBean(t, &Issue{ID: issue.ID}).(*Issue)
AssertInt64InRange(t, now, then, updatedIssue.UpdatedUnix)
AssertInt64InRange(t, now, then, int64(updatedIssue.UpdatedUnix))
}