0
@@ -254,6 +254,17 @@ class TestParsing < Test::Unit::TestCase
0
time = Chronic.parse("this week", :now => @time_2006_08_16_14_00_00, :context => :past)
0
assert_equal Time.local(2006, 8, 14, 19), time
0
+ time = Chronic.parse("this weekend", :now => @time_2006_08_16_14_00_00)
0
+ assert_equal Time.local(2006, 8, 20), time
0
+ time = Chronic.parse("this weekend", :now => @time_2006_08_16_14_00_00, :context => :past)
0
+ assert_equal Time.local(2006, 8, 13), time
0
+ time = Chronic.parse("last weekend", :now => @time_2006_08_16_14_00_00)
0
+ assert_equal Time.local(2006, 8, 13), time
0
time = Chronic.parse("this day", :now => @time_2006_08_16_14_00_00)
0
@@ -386,6 +397,9 @@ class TestParsing < Test::Unit::TestCase
0
time = Chronic.parse("3 weeks ago", :now => @time_2006_08_16_14_00_00)
0
assert_equal Time.local(2006, 7, 26, 14, 30, 30), time
0
+ time = Chronic.parse("2 weekends ago", :now => @time_2006_08_16_14_00_00)
0
+ assert_equal Time.local(2006, 8, 5), time
0
time = Chronic.parse("3 days ago", :now => @time_2006_08_16_14_00_00)
0
assert_equal Time.local(2006, 8, 13, 14), time
0
@@ -418,6 +432,12 @@ class TestParsing < Test::Unit::TestCase
0
time = Chronic.parse("1 week from now", :now => @time_2006_08_16_14_00_00)
0
assert_equal Time.local(2006, 8, 23, 14, 0, 0), time
0
+ time = Chronic.parse("1 weekend from now", :now => @time_2006_08_16_14_00_00)
0
+ assert_equal Time.local(2006, 8, 19), time
0
+ time = Chronic.parse("2 weekends from now", :now => @time_2006_08_16_14_00_00)
0
+ assert_equal Time.local(2006, 8, 26), time
0
time = Chronic.parse("1 day hence", :now => @time_2006_08_16_14_00_00)
0
assert_equal Time.local(2006, 8, 17, 14), time
0
@@ -492,6 +512,10 @@ class TestParsing < Test::Unit::TestCase
0
span = Chronic.parse("november", :now => @time_2006_08_16_14_00_00, :guess => false)
0
assert_equal Time.local(2006, 11), span.begin
0
assert_equal Time.local(2006, 12), span.end
0
+ span = Chronic.parse("weekend" , :now => @time_2006_08_16_14_00_00, :guess => false)
0
+ assert_equal Time.local(2006, 8, 19), span.begin
0
+ assert_equal Time.local(2006, 8, 21), span.end
0
def test_argument_validation
Comments
No one has commented yet.