20 lines
328 B
Go
20 lines
328 B
Go
package stime
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestTime(t *testing.T) {
|
|
result := NowTimeToTime(Format_Normal_YMDhms)
|
|
fmt.Println(result)
|
|
}
|
|
func TestGetAge(t *testing.T) {
|
|
age := GetAge(time.Date(1991, 3, 6, 0, 0, 0, 0, Loc.Shanghai()))
|
|
fmt.Println(age)
|
|
if age != 31 {
|
|
t.Errorf("want 31 but get %v", age)
|
|
}
|
|
}
|