test/test_parsing.rb in chronic-0.9.0 vs test/test_parsing.rb in chronic-0.9.1
- old
+ new
@@ -361,16 +361,30 @@
#
# time = parse_now("13/06")
# assert_equal nil, time
# end
+ def test_handle_sy_sm
+ time = parse_now("2012-06")
+ assert_equal Time.local(2012, 06, 16), time
+
+ time = parse_now("2013/11")
+ assert_equal Time.local(2013, 11, 16), time
+ end
+
def test_handle_r
time = parse_now("9am on Saturday")
assert_equal Time.local(2006, 8, 19, 9), time
time = parse_now("on Tuesday")
assert_equal Time.local(2006, 8, 22, 12), time
+
+ time = parse_now("1:00:00 PM")
+ assert_equal Time.local(2006, 8, 16, 13), time
+
+ time = parse_now("01:00:00 PM")
+ assert_equal Time.local(2006, 8, 16, 13), time
end
def test_handle_r_g_r
end
@@ -1131,9 +1145,13 @@
time = parse_now("Thursday July 31st")
assert_equal Time.local(2006, 7, 31, 12), time
time = parse_now("Thursday December 31st")
assert_equal Time.local(2006, 12, 31, 12), time
+ end
+
+ def test_normalizing_day_portions
+ assert_equal pre_normalize("8:00 pm February 11"), pre_normalize("8:00 p.m. February 11")
end
private
def parse_now(string, options={})
Chronic.parse(string, {:now => TIME_2006_08_16_14_00_00 }.merge(options))