-
Notifications
You must be signed in to change notification settings - Fork 0
/
imperial_related_holiday_test.go
91 lines (85 loc) · 2.48 KB
/
imperial_related_holiday_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package flagday_test
import (
"testing"
"github.com/pinzolo/flagday"
)
func TestWeddingOfPrinceAkihito(t *testing.T) {
_, err := flagday.PublicHolidayOf(1958, 4, 10)
if err == nil {
t.Errorf("1958/04/10 is not holiday")
}
d, err := flagday.PublicHolidayOf(1959, 4, 10)
if err != nil {
t.Errorf("1959/04/10 is not holiday")
}
if d.Name() != "皇太子明仁親王の結婚の儀" {
t.Errorf("invalid holiday name, got %s", d.Name())
}
if d.Kind() != flagday.ImperialRelated {
t.Errorf("kind mismatch, expected %v but got %v", flagday.ImperialRelated, d.Kind())
}
_, err = flagday.PublicHolidayOf(1960, 4, 10)
if err == nil {
t.Errorf("1960/04/10 is not holiday")
}
}
func TestFuneralCeremonyOfEmperorShowa(t *testing.T) {
_, err := flagday.PublicHolidayOf(1988, 2, 24)
if err == nil {
t.Errorf("1988/02/24 is not holiday")
}
d, err := flagday.PublicHolidayOf(1989, 2, 24)
if err != nil {
t.Errorf("1989/02/24 is not holiday")
}
if d.Name() != "昭和天皇の大喪の礼" {
t.Errorf("invalid holiday name, got %s", d.Name())
}
if d.Kind() != flagday.ImperialRelated {
t.Errorf("kind mismatch, expected %v but got %v", flagday.ImperialRelated, d.Kind())
}
_, err = flagday.PublicHolidayOf(1990, 2, 24)
if err == nil {
t.Errorf("1990/02/24 is not holiday")
}
}
func TestCeremonyOfSokuiReiseiden(t *testing.T) {
_, err := flagday.PublicHolidayOf(1989, 11, 12)
if err == nil {
t.Errorf("1988/02/24 is not holiday")
}
d, err := flagday.PublicHolidayOf(1990, 11, 12)
if err != nil {
t.Errorf("1989/02/24 is not holiday")
}
if d.Name() != "即位礼正殿の儀" {
t.Errorf("invalid holiday name, got %s", d.Name())
}
if d.Kind() != flagday.ImperialRelated {
t.Errorf("kind mismatch, expected %v but got %v", flagday.ImperialRelated, d.Kind())
}
_, err = flagday.PublicHolidayOf(1991, 11, 12)
if err == nil {
t.Errorf("1990/02/24 is not holiday")
}
}
func TestWeddingOfPrinceNaruhito(t *testing.T) {
_, err := flagday.PublicHolidayOf(1992, 6, 9)
if err == nil {
t.Errorf("1992/06/09 is not holiday")
}
d, err := flagday.PublicHolidayOf(1993, 6, 9)
if err != nil {
t.Errorf("1993/06/09 is not holiday")
}
if d.Name() != "皇太子徳仁親王の結婚の儀" {
t.Errorf("invalid holiday name, got %s", d.Name())
}
if d.Kind() != flagday.ImperialRelated {
t.Errorf("kind mismatch, expected %v but got %v", flagday.ImperialRelated, d.Kind())
}
_, err = flagday.PublicHolidayOf(1994, 6, 9)
if err == nil {
t.Errorf("1994/06/09 is not holiday")
}
}