home_run 0.9.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/CHANGELOG +3 -0
  2. data/LICENSE +19 -0
  3. data/README.rdoc +314 -0
  4. data/Rakefile +136 -0
  5. data/bench/cpu_bench.rb +279 -0
  6. data/bench/dt_garbage_bench.rb +11 -0
  7. data/bench/dt_mem_bench.rb +14 -0
  8. data/bench/garbage_bench.rb +11 -0
  9. data/bench/mem_bench.rb +14 -0
  10. data/bin/home_run +91 -0
  11. data/default.mspec +12 -0
  12. data/ext/1.8/date_ext.so +0 -0
  13. data/ext/1.9/date_ext.so +0 -0
  14. data/ext/date.rb +7 -0
  15. data/ext/date/format.rb +842 -0
  16. data/ext/date_ext.c +4548 -0
  17. data/ext/date_parser.c +367 -0
  18. data/ext/date_parser.rl +134 -0
  19. data/ext/datetime.c +2804 -0
  20. data/ext/extconf.rb +6 -0
  21. data/spec/date/accessor_spec.rb +176 -0
  22. data/spec/date/add_month_spec.rb +26 -0
  23. data/spec/date/add_spec.rb +23 -0
  24. data/spec/date/boat_spec.rb +38 -0
  25. data/spec/date/civil_spec.rb +147 -0
  26. data/spec/date/commercial_spec.rb +153 -0
  27. data/spec/date/constants_spec.rb +44 -0
  28. data/spec/date/conversions_spec.rb +246 -0
  29. data/spec/date/day_spec.rb +73 -0
  30. data/spec/date/downto_spec.rb +17 -0
  31. data/spec/date/eql_spec.rb +16 -0
  32. data/spec/date/format_spec.rb +52 -0
  33. data/spec/date/gregorian_spec.rb +52 -0
  34. data/spec/date/hash_spec.rb +11 -0
  35. data/spec/date/julian_spec.rb +129 -0
  36. data/spec/date/leap_spec.rb +19 -0
  37. data/spec/date/minus_month_spec.rb +25 -0
  38. data/spec/date/minus_spec.rb +51 -0
  39. data/spec/date/next_prev_spec.rb +108 -0
  40. data/spec/date/ordinal_spec.rb +83 -0
  41. data/spec/date/parse_spec.rb +442 -0
  42. data/spec/date/parsing_spec.rb +77 -0
  43. data/spec/date/relationship_spec.rb +28 -0
  44. data/spec/date/step_spec.rb +109 -0
  45. data/spec/date/strftime_spec.rb +223 -0
  46. data/spec/date/strptime_spec.rb +201 -0
  47. data/spec/date/succ_spec.rb +20 -0
  48. data/spec/date/today_spec.rb +15 -0
  49. data/spec/date/upto_spec.rb +17 -0
  50. data/spec/datetime/accessor_spec.rb +218 -0
  51. data/spec/datetime/add_month_spec.rb +26 -0
  52. data/spec/datetime/add_spec.rb +36 -0
  53. data/spec/datetime/boat_spec.rb +43 -0
  54. data/spec/datetime/constructor_spec.rb +142 -0
  55. data/spec/datetime/conversions_spec.rb +54 -0
  56. data/spec/datetime/day_spec.rb +73 -0
  57. data/spec/datetime/downto_spec.rb +39 -0
  58. data/spec/datetime/eql_spec.rb +17 -0
  59. data/spec/datetime/format_spec.rb +59 -0
  60. data/spec/datetime/hash_spec.rb +11 -0
  61. data/spec/datetime/leap_spec.rb +19 -0
  62. data/spec/datetime/minus_month_spec.rb +25 -0
  63. data/spec/datetime/minus_spec.rb +77 -0
  64. data/spec/datetime/next_prev_spec.rb +138 -0
  65. data/spec/datetime/now_spec.rb +18 -0
  66. data/spec/datetime/parse_spec.rb +390 -0
  67. data/spec/datetime/parsing_spec.rb +77 -0
  68. data/spec/datetime/relationship_spec.rb +28 -0
  69. data/spec/datetime/step_spec.rb +155 -0
  70. data/spec/datetime/strftime_spec.rb +118 -0
  71. data/spec/datetime/strptime_spec.rb +117 -0
  72. data/spec/datetime/succ_spec.rb +24 -0
  73. data/spec/datetime/upto_spec.rb +39 -0
  74. data/spec/spec_helper.rb +59 -0
  75. metadata +154 -0
@@ -0,0 +1,442 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ ruby_version_is "" ... "1.9" do
4
+ describe "Date.zone_to_diff" do
5
+ it "should return the offset for the given time zone name" do
6
+ Date.zone_to_diff('PST').should == -28800
7
+ Date.zone_to_diff('Tokyo').should == 32400
8
+ end
9
+
10
+ it "should return the offset for the given numeric time zone with colons" do
11
+ Date.zone_to_diff('+08:00').should == 28800
12
+ Date.zone_to_diff('+08:30').should == 30600
13
+ Date.zone_to_diff('+08:30:04').should == 30604
14
+ end
15
+
16
+ it "should return the offset for the given numeric time zone with . or ," do
17
+ Date.zone_to_diff('+08,30').should == 29880
18
+ Date.zone_to_diff('+08.30').should == 29880
19
+ end
20
+
21
+ it "should return the offset for the given numeric time with all digits" do
22
+ Date.zone_to_diff('-1').should == -3600
23
+ Date.zone_to_diff('-10').should == -36000
24
+ Date.zone_to_diff('-101').should == -3660
25
+ Date.zone_to_diff('-1010').should == -36600
26
+ Date.zone_to_diff('-10101').should == -36601
27
+ Date.zone_to_diff('-101010').should == -36610
28
+ Date.zone_to_diff('-1010109').should == -36610
29
+ end
30
+
31
+ it "should return 0 if the time zone is not recognized" do
32
+ Date.zone_to_diff('blah').should == 0
33
+ end
34
+ end
35
+ end
36
+
37
+ describe "Date.parse" do
38
+ it "._parse should parse the date string and return a hash" do
39
+ Date._parse('2008-10-20 11:12:13.0-08:00').should == {:mon=>10, :zone=>'-08:00', :sec=>13, :sec_fraction=>0.0, :year=>2008, :hour=>11, :offset=>-28800, :mday=>20, :min=>12}
40
+ Date._parse('2008-10-20 11:12:13.0-08:00', true).should == {:mon=>10, :zone=>'-08:00', :sec=>13, :sec_fraction=>0.0, :year=>2008, :hour=>11, :offset=>-28800, :mday=>20, :min=>12}
41
+ end
42
+
43
+ it "._parse should not contain fields in the hash that were guessed" do
44
+ Date._parse('2008-10-20').should == {:year=>2008, :mday=>20, :mon=>10}
45
+ Date._parse('11:12:13').should == {:sec=>13, :hour=>11, :min=>12}
46
+ end
47
+
48
+ it "should have defaults and an optional sg value" do
49
+ Date.parse.should == Date.jd
50
+ Date.parse('2008-10-11').should == Date.civil(2008, 10, 11)
51
+ Date.parse('2008-10-11', true).should == Date.civil(2008, 10, 11)
52
+ Date.parse('2008-10-11', true, 1).should == Date.civil(2008, 10, 11)
53
+ end
54
+
55
+ it "raises errors for invalid dates" do
56
+ lambda { Date.parse("") }.should raise_error(ArgumentError)
57
+ lambda { Date.parse("2009-02-29") }.should raise_error(ArgumentError)
58
+ end
59
+
60
+ # The space separator is also different, doesn't work for only numbers
61
+ it "can parse a day name into a Date object" do
62
+ d = Date.parse("friday")
63
+ d.should == Date.commercial(d.cwyear, d.cweek, 5)
64
+ end
65
+
66
+ it "can parse a month name into a Date object" do
67
+ d = Date.parse("october")
68
+ d.should == Date.civil(Date.today.year, 10)
69
+ end
70
+
71
+ it "can parse a month day into a Date object" do
72
+ d = Date.parse("5th")
73
+ d.should == Date.civil(Date.today.year, Date.today.month, 5)
74
+ end
75
+
76
+ # Specs using numbers
77
+ it "can't handle a single digit" do
78
+ lambda{ Date.parse("1") }.should raise_error(ArgumentError)
79
+ end
80
+
81
+ it "can handle DD as month day number" do
82
+ d = Date.parse("10")
83
+ d.should == Date.civil(Date.today.year, Date.today.month, 10)
84
+ end
85
+
86
+ it "can handle DDD as year day number" do
87
+ d = Date.parse("100")
88
+ if Date.gregorian_leap?(Date.today.year)
89
+ d.should == Date.civil(Date.today.year, 4, 9)
90
+ else
91
+ d.should == Date.civil(Date.today.year, 4, 10)
92
+ end
93
+ end
94
+
95
+ it "can handle MMDD as month and day" do
96
+ d = Date.parse("1108")
97
+ d.should == Date.civil(Date.today.year, 11, 8)
98
+ end
99
+
100
+ it "can handle YYDDD as year and day number in 1969--2068" do
101
+ d = Date.parse("10100")
102
+ d.should == Date.civil(2010, 4, 10)
103
+ end
104
+
105
+ it "can handle YYMMDD as year month and day in 1969--2068" do
106
+ d = Date.parse("201023")
107
+ d.should == Date.civil(2020, 10, 23)
108
+ end
109
+
110
+ it "can handle YYDDD as a 2 digit year and day number" do
111
+ d = Date.parse("10100", false)
112
+ d.should == Date.civil(10, 4, 10)
113
+ end
114
+
115
+ it "can handle YYMMDD as 2 digit year month and day" do
116
+ d = Date.parse("201023", false)
117
+ d.should == Date.civil(20, 10, 23)
118
+ end
119
+
120
+ it "can handle YYYYDDD as year and day number" do
121
+ d = Date.parse("1910100")
122
+ d.should == Date.civil(1910, 4, 10)
123
+ end
124
+
125
+ it "can handle YYYYMMDD as year and day number" do
126
+ d = Date.parse("19101101")
127
+ d.should == Date.civil(1910, 11, 1)
128
+ end
129
+ end
130
+
131
+ describe :date_parse, :shared => true do
132
+ it "can parse a mmm-YYYY string into a Date object" do
133
+ d = Date.parse("feb#{@sep}2008")
134
+ d.year.should == 2008
135
+ d.month.should == 2
136
+ d.day.should == 1
137
+ end
138
+
139
+ it "can parse a 'DD mmm YYYY' string into a Date object" do
140
+ d = Date.parse("23#{@sep}feb#{@sep}2008")
141
+ d.year.should == 2008
142
+ d.month.should == 2
143
+ d.day.should == 23
144
+ end
145
+
146
+ it "can parse a 'mmm DD YYYY' string into a Date object" do
147
+ d = Date.parse("feb#{@sep}23#{@sep}2008")
148
+ d.year.should == 2008
149
+ d.month.should == 2
150
+ d.day.should == 23
151
+
152
+ d = Date.parse("feb#{@sep}23,#{@sep}2008")
153
+ d.year.should == 2008
154
+ d.month.should == 2
155
+ d.day.should == 23
156
+
157
+ d = Date.parse("feb#{@sep}23,#{@sep}08")
158
+ d.year.should == 2008
159
+ d.month.should == 2
160
+ d.day.should == 23
161
+ end
162
+
163
+ it "can parse a 'YYYY mmm DD' string into a Date object" do
164
+ d = Date.parse("2008#{@sep}feb#{@sep}23")
165
+ d.year.should == 2008
166
+ d.month.should == 2
167
+ d.day.should == 23
168
+ end
169
+
170
+ it "can parse a month name and day into a Date object" do
171
+ Date.parse("november#{@sep}5th").should == Date.civil(Date.today.year, 11, 5)
172
+ end
173
+
174
+ it "can parse a weekday, month, day, and year into a Date object" do
175
+ Date.parse("Mon Aug 10 2009").should == Date.civil(2009, 8, 10)
176
+ end
177
+
178
+ it "can parse a month name, day and year into a Date object" do
179
+ Date.parse("november#{@sep}5th#{@sep}2005").should == Date.civil(2005, 11, 5)
180
+ end
181
+
182
+ it "can parse a year, month name and day into a Date object" do
183
+ Date.parse("2005#{@sep}november#{@sep}5th").should == Date.civil(2005, 11, 5)
184
+ end
185
+
186
+ it "can parse a year, day and month name into a Date object" do
187
+ Date.parse("5th#{@sep}november#{@sep}2005").should == Date.civil(2005, 11, 5)
188
+ end
189
+
190
+ it "can handle negative year numbers" do
191
+ Date.parse("5th#{@sep}november#{@sep}-2005").should == Date.civil(-2005, 11, 5)
192
+ end
193
+ end
194
+
195
+ describe :date_parse_us, :shared => true do
196
+ it "parses a YYYY#{@sep}MM#{@sep}DD string into a Date object" do
197
+ d = Date.parse("2007#{@sep}10#{@sep}01")
198
+ d.year.should == 2007
199
+ d.month.should == 10
200
+ d.day.should == 1
201
+ end
202
+
203
+ ruby_version_is "" ... "1.9" do
204
+ it "parses a MM#{@sep}DD#{@sep}YYYY string into a Date object" do
205
+ d = Date.parse("10#{@sep}01#{@sep}2007")
206
+ d.year.should == 2007
207
+ d.month.should == 10
208
+ d.day.should == 1
209
+ end
210
+
211
+ it "parses a MM#{@sep}DD#{@sep}YY string into a Date object using the year digits as 20XX" do
212
+ d = Date.parse("10#{@sep}01#{@sep}07")
213
+ d.year.should == 2007
214
+ d.month.should == 10
215
+ d.day.should == 1
216
+ end
217
+
218
+ it "parses a MM#{@sep}DD#{@sep}YY string into a Date object using the year digits as 20XX" do
219
+ d = Date.parse("10#{@sep}01#{@sep}07", true)
220
+ d.year.should == 2007
221
+ d.month.should == 10
222
+ d.day.should == 1
223
+ end
224
+
225
+ it "parses a MM#{@sep}DD#{@sep}YY string into a Date object NOT using the year digits as 20XX" do
226
+ d = Date.parse("10#{@sep}01#{@sep}07", false)
227
+ d.year.should == 7
228
+ d.month.should == 10
229
+ d.day.should == 1
230
+ end
231
+ end
232
+
233
+ ruby_version_is "1.9" do
234
+ it "parses a DD#{@sep}MM#{@sep}YYYY string into a Date object" do
235
+ d = Date.parse("10#{@sep}01#{@sep}2007")
236
+ d.year.should == 2007
237
+ d.month.should == 1
238
+ d.day.should == 10
239
+ end
240
+
241
+ it "parses a YY#{@sep}MM#{@sep}DD string into a Date object using the year digits as 20XX" do
242
+ d = Date.parse("10#{@sep}01#{@sep}07")
243
+ d.year.should == 2010
244
+ d.month.should == 1
245
+ d.day.should == 7
246
+ end
247
+
248
+ it "parses a YY#{@sep}MM#{@sep}DD string into a Date object NOT using the year digits as 20XX" do
249
+ d = Date.parse("10#{@sep}01#{@sep}07", false)
250
+ d.year.should == 10
251
+ d.month.should == 1
252
+ d.day.should == 7
253
+ end
254
+
255
+ it "parses a YY#{@sep}MM#{@sep}DD string into a Date object using the year digits as 20XX" do
256
+ d = Date.parse("10#{@sep}01#{@sep}07", true)
257
+ d.year.should == 2010
258
+ d.month.should == 1
259
+ d.day.should == 7
260
+ end
261
+ end
262
+ end
263
+
264
+ describe "Date#parse with '.' separator" do
265
+ before :all do
266
+ @sep = '.'
267
+ end
268
+
269
+ it_should_behave_like "date_parse"
270
+ end
271
+
272
+ describe "Date#parse with '/' separator" do
273
+ before :all do
274
+ @sep = '/'
275
+ end
276
+
277
+ it_should_behave_like "date_parse"
278
+ end
279
+
280
+ describe "Date#parse with ' ' separator" do
281
+ before :all do
282
+ @sep = ' '
283
+ end
284
+
285
+ it_should_behave_like "date_parse"
286
+ end
287
+
288
+ describe "Date#parse with '/' separator US-style" do
289
+ before :all do
290
+ @sep = '/'
291
+ end
292
+
293
+ it_should_behave_like "date_parse_us"
294
+ end
295
+
296
+ ruby_version_is "" ... "1.8.7" do
297
+ describe "Date#parse with '.' separator US-style" do
298
+ before :all do
299
+ @sep = '.'
300
+ end
301
+
302
+ it_should_behave_like "date_parse_us"
303
+ end
304
+ end
305
+
306
+ describe "Date#parse with '-' separator EU-style" do
307
+ # The - separator let's it work like European format, so it as a different spec
308
+ it "can parse a YYYY-MM-DD string into a Date object" do
309
+ d = Date.parse("2007-10-01")
310
+ d.year.should == 2007
311
+ d.month.should == 10
312
+ d.day.should == 1
313
+ end
314
+
315
+ it "can parse a DD-MM-YYYY string into a Date object" do
316
+ d = Date.parse("10-01-2007")
317
+ d.year.should == 2007
318
+ d.month.should == 1
319
+ d.day.should == 10
320
+ end
321
+
322
+ it "can parse a YY-MM-DD string into a Date object" do
323
+ d = Date.parse("10-01-07")
324
+ d.year.should == 2010
325
+ d.month.should == 1
326
+ d.day.should == 7
327
+ end
328
+
329
+ it "can parse a YY-DD-MM string into a Date object" do
330
+ d = Date.parse("10-01-07")
331
+ d.year.should == 2010
332
+ d.month.should == 1
333
+ d.day.should == 7
334
+ end
335
+
336
+ it "can parse a MM-DD-YY string into a Date object NOT using the year digits as 20XX" do
337
+ d = Date.parse("10-01-07", false)
338
+ d.year.should == 10
339
+ d.month.should == 1
340
+ d.day.should == 7
341
+ end
342
+
343
+ it "can parse a YY-MM-DD string into a Date object using the year digits as 20XX" do
344
+ d = Date.parse("10-01-07", true)
345
+ d.year.should == 2010
346
+ d.month.should == 1
347
+ d.day.should == 7
348
+ end
349
+ end
350
+
351
+ ruby_version_is "1.8.7" do
352
+ describe "Date#parse(.)" do
353
+ it "parses a YYYY.MM.DD string into a Date object" do
354
+ d = Date.parse("2007.10.01")
355
+ d.year.should == 2007
356
+ d.month.should == 10
357
+ d.day.should == 1
358
+ end
359
+
360
+ it "parses a DD.MM.YYYY string into a Date object" do
361
+ d = Date.parse("10.01.2007")
362
+ d.year.should == 2007
363
+ d.month.should == 1
364
+ d.day.should == 10
365
+ end
366
+
367
+ ruby_version_is "" ... "1.9" do
368
+ it "parses a YY.MM.DD string into a Date object" do
369
+ d = Date.parse("10.01.07")
370
+ d.year.should == 2010
371
+ d.month.should == 1
372
+ d.day.should == 7
373
+ end
374
+ end
375
+
376
+ ruby_version_is "1.9" do
377
+ it "parses a YY.MM.DD string into a Date object" do
378
+ d = Date.parse("10.01.07")
379
+ d.year.should == 2010
380
+ d.month.should == 1
381
+ d.day.should == 7
382
+ end
383
+ end
384
+
385
+ it "parses a YY.MM.DD string into a Date object using the year digits as 20XX" do
386
+ d = Date.parse("10.01.07", true)
387
+ d.year.should == 2010
388
+ d.month.should == 1
389
+ d.day.should == 7
390
+ end
391
+ end
392
+ end
393
+
394
+ describe "Date::Format::STYLE" do
395
+ before do
396
+ @style = Date::Format::STYLE.dup
397
+ end
398
+ after do
399
+ Date::Format::STYLE.replace(@style)
400
+ end
401
+
402
+ it "Can change DD/DD/DD parsing by modifying Format::STYLE[:slash]" do
403
+ Date::Format::STYLE[:slash] = :ymd
404
+ d = Date.parse("10/01/07")
405
+ d.year.should == 2010
406
+ d.month.should == 1
407
+ d.day.should == 7
408
+
409
+ Date::Format::STYLE[:slash] = :mdy
410
+ d = Date.parse("10/01/07")
411
+ d.year.should == 2007
412
+ d.month.should == 10
413
+ d.day.should == 1
414
+
415
+ Date::Format::STYLE[:slash] = :dmy
416
+ d = Date.parse("10/01/07")
417
+ d.year.should == 2007
418
+ d.month.should == 1
419
+ d.day.should == 10
420
+ end
421
+
422
+ it "Can change DD.DD.DD parsing by modifying Format::STYLE[:dot]" do
423
+ Date::Format::STYLE[:dot] = :ymd
424
+ d = Date.parse("10.01.07")
425
+ d.year.should == 2010
426
+ d.month.should == 1
427
+ d.day.should == 7
428
+
429
+ Date::Format::STYLE[:dot] = :mdy
430
+ d = Date.parse("10.01.07")
431
+ d.year.should == 2007
432
+ d.month.should == 10
433
+ d.day.should == 1
434
+
435
+ Date::Format::STYLE[:dot] = :dmy
436
+ d = Date.parse("10.01.07")
437
+ d.year.should == 2007
438
+ d.month.should == 1
439
+ d.day.should == 10
440
+ end
441
+ end
442
+
@@ -0,0 +1,77 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ ruby_version_is "1.9" do
4
+ describe "Date parsing methods" do
5
+ it "._httpdate should parse an HTTP format" do
6
+ Date._httpdate("Fri, 02 Jan 2009 00:00:00 GMT").should ==
7
+ {:year=>2009, :mon=>1, :mday=>2, :wday=>5, :hour=>0, :min=>0, :sec=>0, :offset=>0, :zone=>'GMT'}
8
+ end
9
+
10
+ it "._iso8601 should parse an ISO8601 format" do
11
+ Date._iso8601("2009-01-02").should == {:year=>2009, :mon=>1, :mday=>2}
12
+ end
13
+
14
+ it "._jisx03010 should parse an JIS X 0301 format" do
15
+ Date._jisx0301("H21.01.02").should == {:year=>2009, :mon=>1, :mday=>2}
16
+ Date._jisx0301("S63.01.02").should == {:year=>1988, :mon=>1, :mday=>2}
17
+ Date._jisx0301("T14.01.02").should == {:year=>1925, :mon=>1, :mday=>2}
18
+ Date._jisx0301("M44.01.02").should == {:year=>1911, :mon=>1, :mday=>2}
19
+ Date._jisx0301("M06.01.02").should == {:year=>1873, :mon=>1, :mday=>2}
20
+ Date._jisx0301("1872-01-02").should == {:year=>1872, :mon=>1, :mday=>2}
21
+ Date._jisx0301("1867-01-02").should == {:year=>1867, :mon=>1, :mday=>2}
22
+ end
23
+
24
+ it "._rfc2822 should parse an RFC2822 format" do
25
+ Date._rfc2822("Fri, 2 Jan 2009 00:00:00 +0000").should ==
26
+ {:year=>2009, :mon=>1, :mday=>2, :wday=>5, :hour=>0, :min=>0, :sec=>0, :offset=>0, :zone=>'+0000'}
27
+ end
28
+
29
+ it "._rfc822 should parse an RFC822 format" do
30
+ Date._rfc822("Fri, 2 Jan 2009 00:00:00 +0000").should ==
31
+ {:year=>2009, :mon=>1, :mday=>2, :wday=>5, :hour=>0, :min=>0, :sec=>0, :offset=>0, :zone=>'+0000'}
32
+ end
33
+
34
+ it "._rfc3339 should parse an RFC3339 format" do
35
+ Date._rfc3339("2009-01-02T00:00:00+00:00").should ==
36
+ {:year=>2009, :mon=>1, :mday=>2, :hour=>0, :min=>0, :sec=>0, :offset=>0, :zone=>'+00:00'}
37
+ end
38
+
39
+ it "._xmlschema should parse an ISO8601 format" do
40
+ Date._xmlschema("2009-01-02").should == {:year=>2009, :mon=>1, :mday=>2}
41
+ end
42
+
43
+ it ".httpdate should parse an HTTP format" do
44
+ Date.httpdate("Fri, 02 Jan 2009 00:00:00 GMT").should == Date.new(2009, 1, 2)
45
+ end
46
+
47
+ it ".iso8601 should parse an ISO8601 format" do
48
+ Date.iso8601("2009-01-02").should == Date.new(2009, 1, 2)
49
+ end
50
+
51
+ it ".jisx03010 should parse an JIS X 0301 format" do
52
+ Date.jisx0301("H21.01.02").should == Date.new(2009, 1, 2)
53
+ Date.jisx0301("S63.01.02").should == Date.new(1988, 1, 2)
54
+ Date.jisx0301("T14.01.02").should == Date.new(1925, 1, 2)
55
+ Date.jisx0301("M44.01.02").should == Date.new(1911, 1, 2)
56
+ Date.jisx0301("M06.01.02").should == Date.new(1873, 1, 2)
57
+ Date.jisx0301("1872-01-02").should == Date.new(1872, 1, 2)
58
+ Date.jisx0301("1867-01-02").should == Date.new(1867, 1, 2)
59
+ end
60
+
61
+ it ".rfc2822 should parse an RFC2822 format" do
62
+ Date.rfc2822("Fri, 2 Jan 2009 00:00:00 +0000").should == Date.new(2009, 1, 2)
63
+ end
64
+
65
+ it ".rfc822 should parse an RFC822 format" do
66
+ Date.rfc822("Fri, 2 Jan 2009 00:00:00 +0000").should == Date.new(2009, 1, 2)
67
+ end
68
+
69
+ it ".rfc3339 should parse an RFC3339 format" do
70
+ Date.rfc3339("2009-01-02T00:00:00+00:00").should == Date.new(2009, 1, 2)
71
+ end
72
+
73
+ it ".xmlschema should parse an ISO8601 format" do
74
+ Date.xmlschema("2009-01-02").should == Date.new(2009, 1, 2)
75
+ end
76
+ end
77
+ end