Skip to content

Commit

Permalink
tests: change test number date
Browse files Browse the repository at this point in the history
  • Loading branch information
fefit committed Oct 22, 2021
1 parent 75934b1 commit 2a9fe70
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dateutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,10 @@ func TestNumberDate(t *testing.T) {
* Test timestamp date
*/
// 2021-09-05 18:07:06 since 1970
var timestamp int = 1630836426
testDate := makeTestTime()
// number date
var timestamp int64 = testDate.Unix()
if date, err := DateTime(timestamp); err == nil {
assert.Equal(t, date.Hour(), 18)
assert.True(t, isSameDate(&date, YMDHis))
} else {
assert.Fail(t, "DateTime int fail")
Expand Down Expand Up @@ -865,8 +866,9 @@ func TestStringDateTime(t *testing.T) {
}

func TestStrToTime(t *testing.T) {
testDate := makeTestTime()
// number date
var timestamp int64 = 1630865226
var timestamp int64 = testDate.Unix()
if date, err := StrToTime(int(timestamp)); err == nil {
assert.Equal(t, date, timestamp)
} else {
Expand Down

0 comments on commit 2a9fe70

Please sign in to comment.