holidays 5.7.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +1 -1
  3. data/CHANGELOG.md +11 -0
  4. data/lib/generated_definitions/north_america.rb +1 -1
  5. data/lib/generated_definitions/tr.rb +1 -0
  6. data/lib/generated_definitions/us.rb +1 -1
  7. data/lib/holidays/definition/context/generator.rb +5 -36
  8. data/lib/holidays/definition/decorator/test.rb +37 -0
  9. data/lib/holidays/definition/entity/test.rb +11 -0
  10. data/lib/holidays/definition/generator/test.rb +51 -0
  11. data/lib/holidays/definition/parser/test.rb +86 -0
  12. data/lib/holidays/definition/validator/test.rb +71 -0
  13. data/lib/holidays/errors.rb +3 -0
  14. data/lib/holidays/factory/definition.rb +24 -0
  15. data/lib/holidays/version.rb +1 -1
  16. data/test/coverage_report.rb +1 -0
  17. data/test/data/test_custom_year_range_holiday_defs.yaml +7 -0
  18. data/test/data/test_multiple_custom_holiday_defs.yaml +7 -4
  19. data/test/data/test_single_custom_holiday_defs.yaml +7 -4
  20. data/test/data/test_single_custom_holiday_with_custom_procs.yaml +11 -7
  21. data/test/defs/test_defs_ar.rb +33 -19
  22. data/test/defs/test_defs_at.rb +14 -11
  23. data/test/defs/test_defs_au.rb +172 -141
  24. data/test/defs/test_defs_be_fr.rb +23 -14
  25. data/test/defs/test_defs_be_nl.rb +23 -14
  26. data/test/defs/test_defs_bg.rb +29 -17
  27. data/test/defs/test_defs_br.rb +33 -19
  28. data/test/defs/test_defs_ca.rb +175 -176
  29. data/test/defs/test_defs_ch.rb +29 -23
  30. data/test/defs/test_defs_cl.rb +49 -27
  31. data/test/defs/test_defs_cr.rb +17 -11
  32. data/test/defs/test_defs_cz.rb +25 -15
  33. data/test/defs/test_defs_de.rb +52 -61
  34. data/test/defs/test_defs_dk.rb +31 -19
  35. data/test/defs/test_defs_ecb_target.rb +14 -10
  36. data/test/defs/test_defs_ee.rb +28 -20
  37. data/test/defs/test_defs_el.rb +29 -17
  38. data/test/defs/test_defs_es.rb +114 -52
  39. data/test/defs/test_defs_europe.rb +1154 -715
  40. data/test/defs/test_defs_federal_reserve.rb +99 -57
  41. data/test/defs/test_defs_fedex.rb +19 -12
  42. data/test/defs/test_defs_fi.rb +47 -27
  43. data/test/defs/test_defs_fr.rb +29 -24
  44. data/test/defs/test_defs_gb.rb +90 -51
  45. data/test/defs/test_defs_ge.rb +40 -28
  46. data/test/defs/test_defs_hk.rb +47 -26
  47. data/test/defs/test_defs_hr.rb +32 -18
  48. data/test/defs/test_defs_hu.rb +26 -16
  49. data/test/defs/test_defs_ie.rb +41 -25
  50. data/test/defs/test_defs_is.rb +39 -22
  51. data/test/defs/test_defs_it.rb +23 -14
  52. data/test/defs/test_defs_jp.rb +112 -59
  53. data/test/defs/test_defs_kr.rb +25 -17
  54. data/test/defs/test_defs_li.rb +20 -20
  55. data/test/defs/test_defs_lt.rb +51 -30
  56. data/test/defs/test_defs_lu.rb +17 -12
  57. data/test/defs/test_defs_ma.rb +17 -11
  58. data/test/defs/test_defs_mt_en.rb +28 -19
  59. data/test/defs/test_defs_mt_mt.rb +28 -19
  60. data/test/defs/test_defs_mx.rb +33 -22
  61. data/test/defs/test_defs_my.rb +11 -8
  62. data/test/defs/test_defs_nerc.rb +17 -11
  63. data/test/defs/test_defs_nl.rb +21 -13
  64. data/test/defs/test_defs_no.rb +31 -18
  65. data/test/defs/test_defs_north_america.rb +507 -393
  66. data/test/defs/test_defs_nyse.rb +26 -15
  67. data/test/defs/test_defs_nz.rb +47 -28
  68. data/test/defs/test_defs_pe.rb +35 -20
  69. data/test/defs/test_defs_ph.rb +17 -11
  70. data/test/defs/test_defs_pl.rb +200 -119
  71. data/test/defs/test_defs_pt.rb +33 -24
  72. data/test/defs/test_defs_ro.rb +39 -24
  73. data/test/defs/test_defs_rs_cyrl.rb +33 -26
  74. data/test/defs/test_defs_rs_la.rb +33 -26
  75. data/test/defs/test_defs_ru.rb +22 -16
  76. data/test/defs/test_defs_scandinavia.rb +193 -116
  77. data/test/defs/test_defs_se.rb +47 -28
  78. data/test/defs/test_defs_sg.rb +13 -9
  79. data/test/defs/test_defs_si.rb +93 -24
  80. data/test/defs/test_defs_sk.rb +29 -17
  81. data/test/defs/test_defs_tn.rb +15 -10
  82. data/test/defs/test_defs_tr.rb +39 -30
  83. data/test/defs/test_defs_united_nations.rb +0 -1
  84. data/test/defs/test_defs_ups.rb +19 -12
  85. data/test/defs/test_defs_us.rb +333 -217
  86. data/test/defs/test_defs_ve.rb +23 -16
  87. data/test/defs/test_defs_vi.rb +10 -8
  88. data/test/defs/test_defs_za.rb +23 -14
  89. data/test/holidays/definition/context/test_generator.rb +40 -13
  90. data/test/holidays/definition/decorator/test_test.rb +123 -0
  91. data/test/holidays/definition/generator/test_test.rb +113 -0
  92. data/test/holidays/definition/parser/test_test.rb +142 -0
  93. data/test/holidays/definition/validator/test_region.rb +5 -0
  94. data/test/holidays/definition/validator/test_test.rb +60 -0
  95. metadata +15 -8
  96. data/test/holidays/factory/test_date_calculator.rb +0 -32
  97. data/test/holidays/factory/test_definition.rb +0 -62
  98. data/test/holidays/factory/test_finder.rb +0 -25
@@ -7,72 +7,125 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class JpDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_jp
10
- {Date.civil(2008,1,1) => '元日',
11
- Date.civil(2010,1,11) => '成人の日',
12
- Date.civil(2008,2,11) => '建国記念の日',
13
- Date.civil(2008,4,29) => '昭和の日',
14
- Date.civil(2008,5,3) => '憲法記念日',
15
- Date.civil(2008,5,5) => 'こどもの日',
16
- Date.civil(2010,7,19) => '海の日',
17
- Date.civil(2010,9,20) => '敬老の日',
18
- Date.civil(2010,10,11) => '体育の日',
19
- Date.civil(2008,11,3) => '文化の日',
20
- Date.civil(2008,11,23) => '勤労感謝の日',
21
- Date.civil(2008,12,23) => '天皇誕生日',
22
- Date.civil(2010,3,22) => '振替休日',
23
- Date.civil(2008,11,24) => '振替休日',
24
- Date.civil(2012,1,2) => '振替休日',
25
- Date.civil(2013,5,6) => '振替休日',
26
- Date.civil(2014,5,6) => '振替休日',
27
- Date.civil(2015,5,6) => '振替休日',
28
- Date.civil(2019,8,12) => '振替休日'
29
- }.each do |date, name|
30
- assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
31
- end
10
+ assert_equal "元日", (Holidays.on(Date.civil(2008, 1, 1), [:jp], [:informal])[0] || {})[:name]
32
11
 
33
- # vernal equinox day
34
- [Date.civil(2004,3,20), Date.civil(2005,3,20), Date.civil(2006,3,21),
35
- Date.civil(2007,3,21), Date.civil(2008,3,20), Date.civil(2009,3,20),
36
- Date.civil(2010,3,21)].each do |date|
37
- assert_equal '春分の日', Holidays.on(date, :jp)[0][:name]
38
- end
12
+ assert_equal "成人の日", (Holidays.on(Date.civil(2010, 1, 11), [:jp], [:informal])[0] || {})[:name]
39
13
 
40
- # national culture day
41
- [Date.civil(2004,9,23), Date.civil(2005,9,23), Date.civil(2006,9,23),
42
- Date.civil(2007,9,23), Date.civil(2008,9,23), Date.civil(2009,9,23),
43
- Date.civil(2010,9,23), Date.civil(2011,9,23), Date.civil(2012,9,22),
44
- Date.civil(2013,9,23)].each do |date|
45
- assert_equal '秋分の日', Holidays.on(date, :jp)[0][:name]
46
- end
14
+ assert_equal "建国記念の日", (Holidays.on(Date.civil(2008, 2, 11), [:jp], [:informal])[0] || {})[:name]
47
15
 
48
- # citizens holiday
49
- [Date.civil(2032,9,21), Date.civil(2049,9,21), Date.civil(2009,9,22),
50
- Date.civil(2015,9,22), Date.civil(2026,9,22)].each do |date|
51
- assert_equal '国民の休日', Holidays.on(date, :jp)[0][:name]
52
- end
16
+ assert_equal "昭和の日", (Holidays.on(Date.civil(2008, 4, 29), [:jp], [:informal])[0] || {})[:name]
53
17
 
54
- # marine day since 1996
55
- [Date.civil(1996, 7, 20), Date.civil(2002, 7, 20), Date.civil(2003, 7, 21),
56
- Date.civil(2004, 7, 19), Date.civil(2005, 7, 18), Date.civil(2006, 7, 17),
57
- Date.civil(2007, 7, 16), Date.civil(2009, 7, 20), Date.civil(2013, 7, 15),
58
- Date.civil(2014, 7, 21)].each do |date|
59
- assert_equal '海の日', Holidays.on(date, :jp)[0][:name]
60
- end
18
+ assert_equal "憲法記念日", (Holidays.on(Date.civil(2008, 5, 3), [:jp], [:informal])[0] || {})[:name]
61
19
 
62
- # mountain holiday start since 2016
63
- [Date.civil(2016,8,11), Date.civil(2017,8,11),Date.civil(2018,8,11),
64
- Date.civil(2019,8,11), Date.civil(2020,8,11),Date.civil(2021,8,11),
65
- Date.civil(2022,8,11)].each do |date|
66
- assert_equal '山の日', Holidays.on(date, :jp)[0][:name]
67
- end
20
+ assert_equal "こどもの日", (Holidays.on(Date.civil(2008, 5, 5), [:jp], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "海の日", (Holidays.on(Date.civil(2010, 7, 19), [:jp], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "敬老の日", (Holidays.on(Date.civil(2010, 9, 20), [:jp], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "体育の日", (Holidays.on(Date.civil(2010, 10, 11), [:jp], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "文化の日", (Holidays.on(Date.civil(2008, 11, 3), [:jp], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "勤労感謝の日", (Holidays.on(Date.civil(2008, 11, 23), [:jp], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "天皇誕生日", (Holidays.on(Date.civil(2008, 12, 23), [:jp], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "振替休日", (Holidays.on(Date.civil(2010, 3, 22), [:jp], [:informal])[0] || {})[:name]
35
+
36
+ assert_equal "振替休日", (Holidays.on(Date.civil(2008, 11, 24), [:jp], [:informal])[0] || {})[:name]
37
+
38
+ assert_equal "振替休日", (Holidays.on(Date.civil(2012, 1, 2), [:jp], [:informal])[0] || {})[:name]
39
+
40
+ assert_equal "振替休日", (Holidays.on(Date.civil(2013, 5, 6), [:jp], [:informal])[0] || {})[:name]
41
+
42
+ assert_equal "振替休日", (Holidays.on(Date.civil(2014, 5, 6), [:jp], [:informal])[0] || {})[:name]
43
+
44
+ assert_equal "振替休日", (Holidays.on(Date.civil(2015, 5, 6), [:jp], [:informal])[0] || {})[:name]
45
+
46
+ assert_equal "振替休日", (Holidays.on(Date.civil(2019, 8, 12), [:jp], [:informal])[0] || {})[:name]
47
+
48
+ assert_equal "春分の日", (Holidays.on(Date.civil(2004, 3, 20), [:jp])[0] || {})[:name]
49
+
50
+ assert_equal "春分の日", (Holidays.on(Date.civil(2005, 3, 20), [:jp])[0] || {})[:name]
51
+
52
+ assert_equal "春分の日", (Holidays.on(Date.civil(2006, 3, 21), [:jp])[0] || {})[:name]
53
+
54
+ assert_equal "春分の日", (Holidays.on(Date.civil(2007, 3, 21), [:jp])[0] || {})[:name]
55
+
56
+ assert_equal "春分の日", (Holidays.on(Date.civil(2008, 3, 20), [:jp])[0] || {})[:name]
57
+
58
+ assert_equal "春分の日", (Holidays.on(Date.civil(2009, 3, 20), [:jp])[0] || {})[:name]
59
+
60
+ assert_equal "春分の日", (Holidays.on(Date.civil(2010, 3, 21), [:jp])[0] || {})[:name]
61
+
62
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2004, 9, 23), [:jp])[0] || {})[:name]
63
+
64
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2005, 9, 23), [:jp])[0] || {})[:name]
65
+
66
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2006, 9, 23), [:jp])[0] || {})[:name]
67
+
68
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2007, 9, 23), [:jp])[0] || {})[:name]
69
+
70
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2008, 9, 23), [:jp])[0] || {})[:name]
71
+
72
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2009, 9, 23), [:jp])[0] || {})[:name]
73
+
74
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2010, 9, 23), [:jp])[0] || {})[:name]
75
+
76
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2011, 9, 23), [:jp])[0] || {})[:name]
77
+
78
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2012, 9, 22), [:jp])[0] || {})[:name]
79
+
80
+ assert_equal "秋分の日", (Holidays.on(Date.civil(2013, 9, 23), [:jp])[0] || {})[:name]
81
+
82
+ assert_equal "国民の休日", (Holidays.on(Date.civil(2032, 9, 21), [:jp])[0] || {})[:name]
83
+
84
+ assert_equal "国民の休日", (Holidays.on(Date.civil(2049, 9, 21), [:jp])[0] || {})[:name]
85
+
86
+ assert_equal "国民の休日", (Holidays.on(Date.civil(2009, 9, 22), [:jp])[0] || {})[:name]
87
+
88
+ assert_equal "国民の休日", (Holidays.on(Date.civil(2015, 9, 22), [:jp])[0] || {})[:name]
89
+
90
+ assert_equal "国民の休日", (Holidays.on(Date.civil(2026, 9, 22), [:jp])[0] || {})[:name]
91
+
92
+ assert_equal "海の日", (Holidays.on(Date.civil(1996, 7, 20), [:jp])[0] || {})[:name]
93
+
94
+ assert_equal "海の日", (Holidays.on(Date.civil(2002, 7, 20), [:jp])[0] || {})[:name]
95
+
96
+ assert_equal "海の日", (Holidays.on(Date.civil(2003, 7, 21), [:jp])[0] || {})[:name]
97
+
98
+ assert_equal "海の日", (Holidays.on(Date.civil(2004, 7, 19), [:jp])[0] || {})[:name]
99
+
100
+ assert_equal "海の日", (Holidays.on(Date.civil(2005, 7, 18), [:jp])[0] || {})[:name]
101
+
102
+ assert_equal "海の日", (Holidays.on(Date.civil(2006, 7, 17), [:jp])[0] || {})[:name]
103
+
104
+ assert_equal "海の日", (Holidays.on(Date.civil(2007, 7, 16), [:jp])[0] || {})[:name]
105
+
106
+ assert_equal "海の日", (Holidays.on(Date.civil(2009, 7, 20), [:jp])[0] || {})[:name]
107
+
108
+ assert_equal "海の日", (Holidays.on(Date.civil(2013, 7, 15), [:jp])[0] || {})[:name]
109
+
110
+ assert_equal "海の日", (Holidays.on(Date.civil(2014, 7, 21), [:jp])[0] || {})[:name]
111
+
112
+ assert_equal "山の日", (Holidays.on(Date.civil(2016, 8, 11), [:jp])[0] || {})[:name]
113
+
114
+ assert_equal "山の日", (Holidays.on(Date.civil(2017, 8, 11), [:jp])[0] || {})[:name]
115
+
116
+ assert_equal "山の日", (Holidays.on(Date.civil(2018, 8, 11), [:jp])[0] || {})[:name]
117
+
118
+ assert_equal "山の日", (Holidays.on(Date.civil(2019, 8, 11), [:jp])[0] || {})[:name]
119
+
120
+ assert_equal "山の日", (Holidays.on(Date.civil(2020, 8, 11), [:jp])[0] || {})[:name]
121
+
122
+ assert_equal "山の日", (Holidays.on(Date.civil(2021, 8, 11), [:jp])[0] || {})[:name]
123
+
124
+ assert_equal "山の日", (Holidays.on(Date.civil(2022, 8, 11), [:jp])[0] || {})[:name]
68
125
 
69
- # before 2016, there is no mountain holiday.
70
- assert_nil Holidays.on(Date.civil(2015,8,11), :jp)[0]
126
+ assert_nil (Holidays.on(Date.civil(2015, 8, 11), [:jp])[0] || {})[:name]
71
127
 
72
- # before 2003, there is no citizens holiday.
73
- # [note] citizens holiday requires that jp_national_culture_day is wednesday.
74
- # Before 2003, the closest past year that mathches above condition is 1998.
75
- assert_nil Holidays.on(Date.civil(1998,9,22), :jp)[0]
128
+ assert_nil (Holidays.on(Date.civil(1998, 9, 22), [:jp])[0] || {})[:name]
76
129
 
77
130
  end
78
131
  end
@@ -7,23 +7,31 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class KrDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_kr
10
- {Date.civil(2016,2,8) => "설날",
11
- Date.civil(2017,1,29) => "설날 연휴",
12
- Date.civil(2016,5,14) => "석가탄신일",
13
- Date.civil(2016,9,15) => "추석",
14
- Date.civil(2016,1,1) => "신정",
15
- Date.civil(2016,3,1) => "3·1절",
16
- Date.civil(2016,5,5) => "어린이날",
17
- Date.civil(2016,6,6) => "현충일",
18
- Date.civil(2016,7,17) => "제헌절",
19
- Date.civil(2016,8,15) => "광복절",
20
- Date.civil(2016,10,3) => "개천절",
21
- Date.civil(2016,10,9) => "한글날",
22
- Date.civil(2016,12,25) => "크리스마스",
23
- Date.civil(2017,1,28) => "설날"
24
- }.each do |date, name|
25
- assert_equal name, (Holidays.on(date, :kr, :informal)[0] || {})[:name]
26
- end
10
+ assert_equal "설날", (Holidays.on(Date.civil(2016, 2, 8), [:kr], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "설날 연휴", (Holidays.on(Date.civil(2017, 1, 29), [:kr], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "석가탄신일", (Holidays.on(Date.civil(2016, 5, 14), [:kr], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "추석", (Holidays.on(Date.civil(2016, 9, 15), [:kr], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "3·1절", (Holidays.on(Date.civil(2016, 3, 1), [:kr], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "어린이날", (Holidays.on(Date.civil(2016, 5, 5), [:kr], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "현충일", (Holidays.on(Date.civil(2016, 6, 6), [:kr], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "제헌절", (Holidays.on(Date.civil(2016, 7, 17), [:kr], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "광복절", (Holidays.on(Date.civil(2016, 8, 15), [:kr], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "개천절", (Holidays.on(Date.civil(2016, 10, 3), [:kr], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "한글날", (Holidays.on(Date.civil(2016, 10, 9), [:kr], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "크리스마스", (Holidays.on(Date.civil(2016, 12, 25), [:kr], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "설날", (Holidays.on(Date.civil(2017, 1, 28), [:kr], [:informal])[0] || {})[:name]
27
35
 
28
36
  end
29
37
  end
@@ -7,29 +7,29 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class LiDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_li
10
- {Date.civil(2009,1,1) => 'Neujahrstag',
11
- Date.civil(2011,3,8) => 'Fasnachtsdienstag',
12
- Date.civil(2009,4,10) => 'Karfreitag',
13
- Date.civil(2009,4,12) => 'Ostern',
14
- Date.civil(2009,4,13) => 'Ostermontag',
15
- Date.civil(2009,5,21) => 'Auffahrt',
16
- Date.civil(2009,6,1) => 'Pfingstmontag',
17
- Date.civil(2009,12,25) => 'Weihnachten',
18
- Date.civil(2009,12,26) => 'Stefanstag'}.each do |date, name|
19
- assert_equal name, Holidays.on(date, :li, :informal)[0][:name]
20
- end
10
+ assert_equal "Neujahrstag", (Holidays.on(Date.civil(2009, 1, 1), [:li], [:informal])[0] || {})[:name]
21
11
 
22
- [:li].each do |r|
23
- assert_equal 'Fronleichnam', Holidays.on(Date.civil(2009,6,11), r)[0][:name]
24
- end
12
+ assert_equal "Fasnachtsdienstag", (Holidays.on(Date.civil(2011, 3, 8), [:li], [:informal])[0] || {})[:name]
25
13
 
26
- [:li].each do |r|
27
- assert_equal 'Staatsfeiertag', Holidays.on(Date.civil(2009,8,15), r)[0][:name]
28
- end
14
+ assert_equal "Karfreitag", (Holidays.on(Date.civil(2009, 4, 10), [:li], [:informal])[0] || {})[:name]
29
15
 
30
- [:li].each do |r|
31
- assert_equal 'Allerheiligen', Holidays.on(Date.civil(2009,11,1), r)[0][:name]
32
- end
16
+ assert_equal "Ostern", (Holidays.on(Date.civil(2009, 4, 12), [:li], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Ostermontag", (Holidays.on(Date.civil(2009, 4, 13), [:li], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Auffahrt", (Holidays.on(Date.civil(2009, 5, 21), [:li], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Pfingstmontag", (Holidays.on(Date.civil(2009, 6, 1), [:li], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Weihnachten", (Holidays.on(Date.civil(2009, 12, 25), [:li], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Stefanstag", (Holidays.on(Date.civil(2009, 12, 26), [:li], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Fronleichnam", (Holidays.on(Date.civil(2009, 6, 11), [:li])[0] || {})[:name]
29
+
30
+ assert_equal "Staatsfeiertag", (Holidays.on(Date.civil(2009, 8, 15), [:li])[0] || {})[:name]
31
+
32
+ assert_equal "Allerheiligen", (Holidays.on(Date.civil(2009, 11, 1), [:li])[0] || {})[:name]
33
33
 
34
34
  end
35
35
  end
@@ -7,36 +7,57 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class LtDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_lt
10
- {Date.civil(2008,1,1) => 'Naujieji metai',
11
- Date.civil(2008,2,16) => 'Valstybės atkūrimo diena',
12
- Date.civil(2008,3,11) => 'Nepriklausomybės atkūrimo diena',
13
- Date.civil(2008,3,23) => 'Šv. Velykos',
14
- Date.civil(2008,3,24) => 'Antroji Velykų diena',
15
- Date.civil(2008,5,1) => 'Darbininkų diena',
16
- Date.civil(2008,6,24) => 'Joninės',
17
- Date.civil(2008,7,6) => 'Valstybės diena',
18
- Date.civil(2008,8,15) => 'Žolinė',
19
- Date.civil(2008,11,1) => 'Visų šventųjų diena',
20
- Date.civil(2008,12,24) => 'Šv. Kūčios',
21
- Date.civil(2008,12,25) => 'Šv. Kalėdos',
22
- Date.civil(2008,12,26) => 'Antroji Kalėdų diena'}.each do |date, name|
23
- assert_equal name, (Holidays.on(date, :lt)[0] || {})[:name]
24
- end
25
- {Date.civil(2012,1,1) => 'Naujieji metai',
26
- Date.civil(2012,2,16) => 'Valstybės atkūrimo diena',
27
- Date.civil(2012,3,11) => 'Nepriklausomybės atkūrimo diena',
28
- Date.civil(2012,4,8) => 'Šv. Velykos',
29
- Date.civil(2012,4,9) => 'Antroji Velykų diena',
30
- Date.civil(2012,5,1) => 'Darbininkų diena',
31
- Date.civil(2012,6,24) => 'Joninės',
32
- Date.civil(2012,7,6) => 'Valstybės diena',
33
- Date.civil(2012,8,15) => 'Žolinė',
34
- Date.civil(2012,11,1) => 'Visų šventųjų diena',
35
- Date.civil(2012,12,24) => 'Šv. Kūčios',
36
- Date.civil(2012,12,25) => 'Šv. Kalėdos',
37
- Date.civil(2012,12,26) => 'Antroji Kalėdų diena'}.each do |date, name|
38
- assert_equal name, (Holidays.on(date, :lt)[0] || {})[:name]
39
- end
10
+ assert_equal "Naujieji metai", (Holidays.on(Date.civil(2008, 1, 1), [:lt])[0] || {})[:name]
11
+
12
+ assert_equal "Valstybės atkūrimo diena", (Holidays.on(Date.civil(2008, 2, 16), [:lt])[0] || {})[:name]
13
+
14
+ assert_equal "Nepriklausomybės atkūrimo diena", (Holidays.on(Date.civil(2008, 3, 11), [:lt])[0] || {})[:name]
15
+
16
+ assert_equal "Šv. Velykos", (Holidays.on(Date.civil(2008, 3, 23), [:lt])[0] || {})[:name]
17
+
18
+ assert_equal "Antroji Velykų diena", (Holidays.on(Date.civil(2008, 3, 24), [:lt])[0] || {})[:name]
19
+
20
+ assert_equal "Darbininkų diena", (Holidays.on(Date.civil(2008, 5, 1), [:lt])[0] || {})[:name]
21
+
22
+ assert_equal "Joninės", (Holidays.on(Date.civil(2008, 6, 24), [:lt])[0] || {})[:name]
23
+
24
+ assert_equal "Valstybės diena", (Holidays.on(Date.civil(2008, 7, 6), [:lt])[0] || {})[:name]
25
+
26
+ assert_equal "Žolinė", (Holidays.on(Date.civil(2008, 8, 15), [:lt])[0] || {})[:name]
27
+
28
+ assert_equal "Visų šventųjų diena", (Holidays.on(Date.civil(2008, 11, 1), [:lt])[0] || {})[:name]
29
+
30
+ assert_equal "Šv. Kūčios", (Holidays.on(Date.civil(2008, 12, 24), [:lt])[0] || {})[:name]
31
+
32
+ assert_equal "Šv. Kalėdos", (Holidays.on(Date.civil(2008, 12, 25), [:lt])[0] || {})[:name]
33
+
34
+ assert_equal "Antroji Kalėdų diena", (Holidays.on(Date.civil(2008, 12, 26), [:lt])[0] || {})[:name]
35
+
36
+ assert_equal "Naujieji metai", (Holidays.on(Date.civil(2012, 1, 1), [:lt])[0] || {})[:name]
37
+
38
+ assert_equal "Valstybės atkūrimo diena", (Holidays.on(Date.civil(2012, 2, 16), [:lt])[0] || {})[:name]
39
+
40
+ assert_equal "Nepriklausomybės atkūrimo diena", (Holidays.on(Date.civil(2012, 3, 11), [:lt])[0] || {})[:name]
41
+
42
+ assert_equal "Šv. Velykos", (Holidays.on(Date.civil(2012, 4, 8), [:lt])[0] || {})[:name]
43
+
44
+ assert_equal "Antroji Velykų diena", (Holidays.on(Date.civil(2012, 4, 9), [:lt])[0] || {})[:name]
45
+
46
+ assert_equal "Darbininkų diena", (Holidays.on(Date.civil(2012, 5, 1), [:lt])[0] || {})[:name]
47
+
48
+ assert_equal "Joninės", (Holidays.on(Date.civil(2012, 6, 24), [:lt])[0] || {})[:name]
49
+
50
+ assert_equal "Valstybės diena", (Holidays.on(Date.civil(2012, 7, 6), [:lt])[0] || {})[:name]
51
+
52
+ assert_equal "Žolinė", (Holidays.on(Date.civil(2012, 8, 15), [:lt])[0] || {})[:name]
53
+
54
+ assert_equal "Visų šventųjų diena", (Holidays.on(Date.civil(2012, 11, 1), [:lt])[0] || {})[:name]
55
+
56
+ assert_equal "Šv. Kūčios", (Holidays.on(Date.civil(2012, 12, 24), [:lt])[0] || {})[:name]
57
+
58
+ assert_equal "Šv. Kalėdos", (Holidays.on(Date.civil(2012, 12, 25), [:lt])[0] || {})[:name]
59
+
60
+ assert_equal "Antroji Kalėdų diena", (Holidays.on(Date.civil(2012, 12, 26), [:lt])[0] || {})[:name]
40
61
 
41
62
  end
42
63
  end
@@ -7,18 +7,23 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class LuDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_lu
10
- {Date.civil(2008,1,1) => 'Neijoerschdag',
11
- Date.civil(2008,3,24) => 'Ouschterméindeg',
12
- Date.civil(2008,5,1) => 'Christi Himmelfaart', # Ascension, Easter+39
13
- Date.civil(2008,6,23) => 'Nationalfeierdag',
14
- Date.civil(2008,8,15) => 'Léiffrawëschdag',
15
- Date.civil(2008,11,1) => 'Allerhellgen',
16
- Date.civil(2008,12,25) => 'Chrëschtdag',
17
- Date.civil(2008,12,26) => 'Stiefesdag',
18
- Date.civil(2008,5,11) => 'Péngschtméindeg'
19
- }.each do |date, name|
20
- assert_equal name, (Holidays.on(date, :lu, :informal)[0] || {})[:name]
21
- end
10
+ assert_equal "Neijoerschdag", (Holidays.on(Date.civil(2008, 1, 1), [:lu], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Ouschterméindeg", (Holidays.on(Date.civil(2008, 3, 24), [:lu], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Christi Himmelfaart", (Holidays.on(Date.civil(2008, 5, 1), [:lu], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Nationalfeierdag", (Holidays.on(Date.civil(2008, 6, 23), [:lu], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Léiffrawëschdag", (Holidays.on(Date.civil(2008, 8, 15), [:lu], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Allerhellgen", (Holidays.on(Date.civil(2008, 11, 1), [:lu], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Chrëschtdag", (Holidays.on(Date.civil(2008, 12, 25), [:lu], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Stiefesdag", (Holidays.on(Date.civil(2008, 12, 26), [:lu], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Péngschtméindeg", (Holidays.on(Date.civil(2008, 5, 11), [:lu], [:informal])[0] || {})[:name]
22
27
 
23
28
  end
24
29
  end
@@ -7,17 +7,23 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class MaDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_ma
10
- {Date.civil(2007,1,1) => 'Ras l\' âm',
11
- Date.civil(2007,1,11) => 'Takdim watikat al-istiqlal',
12
- Date.civil(2007,5,1) => 'Eid Ash-Shughl',
13
- Date.civil(2007,7,30) => 'Eid Al-Ârch',
14
- Date.civil(2007,8,14) => 'Zikra Oued Ed-Dahab',
15
- Date.civil(2007,8,20) => 'Thawrat al malik wa shâab',
16
- Date.civil(2007,8,21) => 'Eid Al Milad',
17
- Date.civil(2007,11,6) => 'Eid Al Massira Al Khadra',
18
- Date.civil(2007,11,18) => 'Eid Al Istiqulal'}.each do |date, name|
19
- assert_equal name, (Holidays.on(date, :ma, :informal)[0] || {})[:name]
20
- end
10
+ assert_equal "Ras l' âm", (Holidays.on(Date.civil(2007, 1, 1), [:ma], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Takdim watikat al-istiqlal", (Holidays.on(Date.civil(2007, 1, 11), [:ma], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Eid Ash-Shughl", (Holidays.on(Date.civil(2007, 5, 1), [:ma], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Eid Al-Ârch", (Holidays.on(Date.civil(2007, 7, 30), [:ma], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Zikra Oued Ed-Dahab", (Holidays.on(Date.civil(2007, 8, 14), [:ma], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Thawrat al malik wa shâab", (Holidays.on(Date.civil(2007, 8, 20), [:ma], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Eid Al Milad", (Holidays.on(Date.civil(2007, 8, 21), [:ma], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Eid Al Massira Al Khadra", (Holidays.on(Date.civil(2007, 11, 6), [:ma], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Eid Al Istiqulal", (Holidays.on(Date.civil(2007, 11, 18), [:ma], [:informal])[0] || {})[:name]
21
27
 
22
28
  end
23
29
  end
@@ -7,26 +7,35 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class Mt_enDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_mt_en
10
- { Date.civil(2017, 1, 1) => "New Year's Day",
11
- Date.civil(2017, 2, 10) => "Feast of Saint Paul's Shipwreck in Malta",
12
- Date.civil(2017, 3, 19) => 'Feast of Saint Joseph',
13
- Date.civil(2017, 3, 31) => 'Freedom Day',
14
- Date.civil(2017, 5, 1) => "Worker's Day",
15
- Date.civil(2017, 6, 7) => 'Sette Giugno',
16
- Date.civil(2017, 6, 29) => 'Feast of Saint Peter & Saint Paul',
17
- Date.civil(2017, 8, 15) => 'Feast of the Assumption of Our Lady',
18
- Date.civil(2017, 9, 8) => 'Victory Day',
19
- Date.civil(2017, 9, 21) => 'Independence Day',
20
- Date.civil(2017, 12, 8) => 'Feast of the Immaculate Conception',
21
- Date.civil(2017, 12, 13) => 'Republic Day',
22
- Date.civil(2017, 12, 25) => 'Christmas Day',
23
- }.each do |date, name|
24
- assert_equal name, (Holidays.on(date, :mt_en)[0] || {})[:name]
25
- end
10
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2017, 1, 1), [:mt_en])[0] || {})[:name]
26
11
 
27
- [Date.civil(2017, 4, 14), Date.civil(2018, 3, 30), Date.civil(2019, 4, 19)].each do |date|
28
- assert_equal 'Good Friday', Holidays.on(date, :mt_en)[0][:name]
29
- end
12
+ assert_equal "Feast of Saint Paul's Shipwreck in Malta", (Holidays.on(Date.civil(2017, 2, 10), [:mt_en])[0] || {})[:name]
13
+
14
+ assert_equal "Feast of Saint Joseph", (Holidays.on(Date.civil(2017, 3, 19), [:mt_en])[0] || {})[:name]
15
+
16
+ assert_equal "Freedom Day", (Holidays.on(Date.civil(2017, 3, 31), [:mt_en])[0] || {})[:name]
17
+
18
+ assert_equal "Worker's Day", (Holidays.on(Date.civil(2017, 5, 1), [:mt_en])[0] || {})[:name]
19
+
20
+ assert_equal "Sette Giugno", (Holidays.on(Date.civil(2017, 6, 7), [:mt_en])[0] || {})[:name]
21
+
22
+ assert_equal "Feast of Saint Peter & Saint Paul", (Holidays.on(Date.civil(2017, 6, 29), [:mt_en])[0] || {})[:name]
23
+
24
+ assert_equal "Feast of the Assumption of Our Lady", (Holidays.on(Date.civil(2017, 8, 15), [:mt_en])[0] || {})[:name]
25
+
26
+ assert_equal "Victory Day", (Holidays.on(Date.civil(2017, 9, 8), [:mt_en])[0] || {})[:name]
27
+
28
+ assert_equal "Independence Day", (Holidays.on(Date.civil(2017, 9, 21), [:mt_en])[0] || {})[:name]
29
+
30
+ assert_equal "Feast of the Immaculate Conception", (Holidays.on(Date.civil(2017, 12, 8), [:mt_en])[0] || {})[:name]
31
+
32
+ assert_equal "Republic Day", (Holidays.on(Date.civil(2017, 12, 13), [:mt_en])[0] || {})[:name]
33
+
34
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2017, 12, 25), [:mt_en])[0] || {})[:name]
35
+
36
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2017, 4, 14), [:mt_en])[0] || {})[:name]
37
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2018, 3, 30), [:mt_en])[0] || {})[:name]
38
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2019, 4, 19), [:mt_en])[0] || {})[:name]
30
39
 
31
40
  end
32
41
  end