d198a056a7
By default, matching is now limited to unmatched faces and markers.
57 lines
980 B
Go
57 lines
980 B
Go
package entity
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestTimeStamp(t *testing.T) {
|
|
result := TimeStamp()
|
|
|
|
if result.Location() != time.UTC {
|
|
t.Fatal("timestamp zone must be utc")
|
|
}
|
|
|
|
if result.After(time.Now().Add(time.Second)) {
|
|
t.Fatal("timestamp should be in the past from now")
|
|
}
|
|
}
|
|
|
|
func TestTimePointer(t *testing.T) {
|
|
result := TimePointer()
|
|
|
|
if result == nil {
|
|
t.Fatal("result must not be nil")
|
|
}
|
|
|
|
if result.Location() != time.UTC {
|
|
t.Fatal("timestamp zone must be utc")
|
|
}
|
|
|
|
if result.After(time.Now().Add(time.Second)) {
|
|
t.Fatal("timestamp should be in the past from now")
|
|
}
|
|
}
|
|
|
|
func TestSeconds(t *testing.T) {
|
|
result := Seconds(23)
|
|
|
|
if result != 23*time.Second {
|
|
t.Error("must be 23 seconds")
|
|
}
|
|
}
|
|
|
|
func TestYesterday(t *testing.T) {
|
|
now := time.Now()
|
|
result := Yesterday()
|
|
|
|
t.Logf("yesterday: %s", result)
|
|
|
|
if result.After(now) {
|
|
t.Error("yesterday is not before now")
|
|
}
|
|
|
|
if !result.Before(now) {
|
|
t.Error("yesterday is before now")
|
|
}
|
|
}
|