chronic 0.4.1 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/.gitignore +5 -0
- data/.yardopts +3 -0
- data/HISTORY.md +75 -2
- data/README.md +10 -5
- data/Rakefile +12 -106
- data/chronic.gemspec +12 -78
- data/lib/chronic/chronic.rb +271 -101
- data/lib/chronic/grabber.rb +12 -3
- data/lib/chronic/handler.rb +90 -0
- data/lib/chronic/handlers.rb +247 -295
- data/lib/chronic/mini_date.rb +15 -5
- data/lib/chronic/numerizer.rb +3 -2
- data/lib/chronic/ordinal.rb +15 -4
- data/lib/chronic/pointer.rb +13 -5
- data/lib/chronic/repeater.rb +31 -15
- data/lib/chronic/repeaters/repeater_day.rb +6 -7
- data/lib/chronic/repeaters/repeater_day_name.rb +1 -2
- data/lib/chronic/repeaters/repeater_day_portion.rb +12 -13
- data/lib/chronic/repeaters/repeater_fortnight.rb +2 -3
- data/lib/chronic/repeaters/repeater_hour.rb +7 -8
- data/lib/chronic/repeaters/repeater_minute.rb +6 -7
- data/lib/chronic/repeaters/repeater_month.rb +22 -11
- data/lib/chronic/repeaters/repeater_month_name.rb +16 -24
- data/lib/chronic/repeaters/repeater_season.rb +10 -29
- data/lib/chronic/repeaters/repeater_season_name.rb +2 -4
- data/lib/chronic/repeaters/repeater_second.rb +0 -1
- data/lib/chronic/repeaters/repeater_time.rb +19 -20
- data/lib/chronic/repeaters/repeater_week.rb +0 -1
- data/lib/chronic/repeaters/repeater_weekday.rb +1 -2
- data/lib/chronic/repeaters/repeater_weekend.rb +0 -1
- data/lib/chronic/repeaters/repeater_year.rb +29 -18
- data/lib/chronic/scalar.rb +29 -1
- data/lib/chronic/season.rb +37 -0
- data/lib/chronic/separator.rb +24 -7
- data/lib/chronic/tag.rb +12 -1
- data/lib/chronic/time_zone.rb +14 -5
- data/lib/chronic/token.rb +14 -4
- data/lib/chronic.rb +66 -89
- data/test/helper.rb +1 -1
- data/test/test_Chronic.rb +97 -3
- data/test/test_DaylightSavings.rb +1 -1
- data/test/test_Handler.rb +1 -6
- data/test/test_MiniDate.rb +3 -3
- data/test/test_Numerizer.rb +1 -1
- data/test/test_RepeaterDayName.rb +1 -1
- data/test/test_RepeaterFortnight.rb +1 -1
- data/test/test_RepeaterHour.rb +1 -1
- data/test/test_RepeaterMinute.rb +1 -1
- data/test/test_RepeaterMonth.rb +5 -1
- data/test/test_RepeaterMonthName.rb +1 -1
- data/test/test_RepeaterSeason.rb +40 -0
- data/test/test_RepeaterTime.rb +1 -1
- data/test/test_RepeaterWeek.rb +1 -1
- data/test/test_RepeaterWeekday.rb +1 -1
- data/test/test_RepeaterWeekend.rb +1 -1
- data/test/test_RepeaterYear.rb +8 -1
- data/test/test_Span.rb +1 -1
- data/test/test_Token.rb +1 -1
- data/test/test_parsing.rb +228 -117
- metadata +30 -32
- data/Manifest.txt +0 -59
- data/benchmark/benchmark.rb +0 -13
- data/test/test_Time.rb +0 -49
data/test/test_Time.rb
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), *%w[helper])
|
|
2
|
-
|
|
3
|
-
class TestTime < Test::Unit::TestCase
|
|
4
|
-
|
|
5
|
-
def setup
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def test_normal
|
|
9
|
-
assert_equal Time.local(2006, 1, 2, 0, 0, 0), Time.construct(2006, 1, 2, 0, 0, 0)
|
|
10
|
-
assert_equal Time.local(2006, 1, 2, 3, 0, 0), Time.construct(2006, 1, 2, 3, 0, 0)
|
|
11
|
-
assert_equal Time.local(2006, 1, 2, 3, 4, 0), Time.construct(2006, 1, 2, 3, 4, 0)
|
|
12
|
-
assert_equal Time.local(2006, 1, 2, 3, 4, 5), Time.construct(2006, 1, 2, 3, 4, 5)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def test_second_overflow
|
|
16
|
-
assert_equal Time.local(2006, 1, 1, 0, 1, 30), Time.construct(2006, 1, 1, 0, 0, 90)
|
|
17
|
-
assert_equal Time.local(2006, 1, 1, 0, 5, 0), Time.construct(2006, 1, 1, 0, 0, 300)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def test_minute_overflow
|
|
21
|
-
assert_equal Time.local(2006, 1, 1, 1, 30), Time.construct(2006, 1, 1, 0, 90)
|
|
22
|
-
assert_equal Time.local(2006, 1, 1, 5), Time.construct(2006, 1, 1, 0, 300)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def test_hour_overflow
|
|
26
|
-
assert_equal Time.local(2006, 1, 2, 12), Time.construct(2006, 1, 1, 36)
|
|
27
|
-
assert_equal Time.local(2006, 1, 7), Time.construct(2006, 1, 1, 144)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def test_day_overflow
|
|
31
|
-
assert_equal Time.local(2006, 2, 1), Time.construct(2006, 1, 32)
|
|
32
|
-
assert_equal Time.local(2006, 3, 5), Time.construct(2006, 2, 33)
|
|
33
|
-
assert_equal Time.local(2004, 3, 4), Time.construct(2004, 2, 33)
|
|
34
|
-
assert_equal Time.local(2000, 3, 5), Time.construct(2000, 2, 33)
|
|
35
|
-
|
|
36
|
-
assert_nothing_raised do
|
|
37
|
-
Time.construct(2006, 1, 56)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
assert_raise(RuntimeError) do
|
|
41
|
-
Time.construct(2006, 1, 57)
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_month_overflow
|
|
46
|
-
assert_equal Time.local(2006, 1), Time.construct(2005, 13)
|
|
47
|
-
assert_equal Time.local(2005, 12), Time.construct(2000, 72)
|
|
48
|
-
end
|
|
49
|
-
end
|