Skip to content

Commit

Permalink
Add Meiji example and test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ushios committed Jul 16, 2016
1 parent 6b462f2 commit d9665e5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ fmt.Println(g)
// Output:
// 平成
```

```go
t, _ := time.Parse("2006-01-02 15:04:05 -0700", "1912-07-29 23:59:59 +0900")
g := gengo.At(t)

fmt.Println(g)
// Output:
// 明治
```
17 changes: 17 additions & 0 deletions gengo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,27 @@ func AtTest(t *testing.T) {
test("1912-07-29 23:59:59 +0900", Meiji)
}

func NowTest(t *testing.T) {
g := Now()

if g != Heisei {
t.Errorf("expected(%s) but (%s) now", Heisei, g)
}
}

func ExampleNow() {
g := Now()

fmt.Println(g)
// Output:
// 平成
}

func ExampleAt() {
t, _ := time.Parse(DateTimeFormat, "1912-07-29 23:59:59 +0900")
g := At(t)

fmt.Println(g)
// Output:
// 明治
}

0 comments on commit d9665e5

Please sign in to comment.