|
| 1 | +require 'helper' |
| 2 | + |
| 3 | +class TestDefinitions < TestCase |
| 4 | + |
| 5 | + def setup |
| 6 | + end |
| 7 | + |
| 8 | + # DayName, MonthName ScalarDay, ScalarYear |
| 9 | + def test_dn_mn_sd_sy |
| 10 | + time = Chronic.parse('Wed Sep 27 2017', :guess => false) |
| 11 | + assert_equal Time.local(2017, 9, 27, 0), time.begin |
| 12 | + assert_equal Time.local(2017, 9, 28, 0), time.end |
| 13 | + |
| 14 | + time = Chronic.parse('Wed, Sep 27, 2017', :guess => false) |
| 15 | + assert_equal Time.local(2017, 9, 27, 0), time.begin |
| 16 | + assert_equal Time.local(2017, 9, 28, 0), time.end |
| 17 | + end |
| 18 | + |
| 19 | + # DayName, MonthName OrdinalDay, ScalarYear |
| 20 | + def test_dn_mn_od_sy |
| 21 | + time = Chronic.parse('Sun Oct 22nd 2017', :guess => false) |
| 22 | + assert_equal Time.local(2017, 10, 22, 0), time.begin |
| 23 | + assert_equal Time.local(2017, 10, 23, 0), time.end |
| 24 | + |
| 25 | + time = Chronic.parse('Mon Oct 30th 2017', :guess => false) |
| 26 | + assert_equal Time.local(2017, 10, 30, 0), time.begin |
| 27 | + assert_equal Time.local(2017, 10, 31, 0), time.end |
| 28 | + |
| 29 | + time = Chronic.parse('Sun, Oct 22nd, 2017', :guess => false) |
| 30 | + assert_equal Time.local(2017, 10, 22, 0), time.begin |
| 31 | + assert_equal Time.local(2017, 10, 23, 0), time.end |
| 32 | + |
| 33 | + time = Chronic.parse('Mon, Oct 30th, 2017', :guess => false) |
| 34 | + assert_equal Time.local(2017, 10, 30, 0), time.begin |
| 35 | + assert_equal Time.local(2017, 10, 31, 0), time.end |
| 36 | + |
| 37 | + end |
| 38 | + |
| 39 | +end |
| 40 | + |
0 commit comments