kos/util/humanize/time_test.go

27 lines
381 B
Go

package humanize
import (
"encoding/json"
"testing"
)
type test struct {
Time Time
}
func TestNow(t *testing.T) {
tm := Now().Add(-1 * Hour * 223)
t.Log(tm.Ago())
ts := &test{Time: Now()}
buf, err := json.Marshal(ts)
if err != nil {
t.Error(err)
}
t.Log(string(buf))
vv := &test{}
if err = json.Unmarshal(buf, vv); err != nil {
t.Error(err)
}
t.Log(vv.Time)
}