From: Chuck Hagenbuch Date: Sat, 7 Feb 2009 17:32:54 +0000 (-0500) Subject: remove chronic files we're done with X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=05d39e25e361835723d4155b5985f135e504445d;p=horde.git remove chronic files we're done with --- diff --git a/framework/Date_Parser/chronic/test/suite.rb b/framework/Date_Parser/chronic/test/suite.rb deleted file mode 100644 index fa8bdaab5..000000000 --- a/framework/Date_Parser/chronic/test/suite.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test/unit' - -tests = Dir["#{File.dirname(__FILE__)}/test_*.rb"] -tests.delete_if { |o| o =~ /test_parsing/ } -tests.each do |file| - require file -end - -require File.dirname(__FILE__) + '/test_parsing.rb' \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_RepeaterDayName.rb b/framework/Date_Parser/chronic/test/test_RepeaterDayName.rb deleted file mode 100644 index 8e119db30..000000000 --- a/framework/Date_Parser/chronic/test/test_RepeaterDayName.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestRepeaterDayName < Test::Unit::TestCase - - def setup - @now = Time.local(2006, 8, 16, 14, 0, 0, 0) - end - - def test_match - token = Chronic::Token.new('saturday') - repeater = Chronic::Repeater.scan_for_day_names(token) - assert_equal Chronic::RepeaterDayName, repeater.class - assert_equal :saturday, repeater.type - - token = Chronic::Token.new('sunday') - repeater = Chronic::Repeater.scan_for_day_names(token) - assert_equal Chronic::RepeaterDayName, repeater.class - assert_equal :sunday, repeater.type - end - - def test_next_future - mondays = Chronic::RepeaterDayName.new(:monday) - mondays.start = @now - - span = mondays.next(:future) - - assert_equal Time.local(2006, 8, 21), span.begin - assert_equal Time.local(2006, 8, 22), span.end - - span = mondays.next(:future) - - assert_equal Time.local(2006, 8, 28), span.begin - assert_equal Time.local(2006, 8, 29), span.end - end - - def test_next_past - mondays = Chronic::RepeaterDayName.new(:monday) - mondays.start = @now - - span = mondays.next(:past) - - assert_equal Time.local(2006, 8, 14), span.begin - assert_equal Time.local(2006, 8, 15), span.end - - span = mondays.next(:past) - - assert_equal Time.local(2006, 8, 7), span.begin - assert_equal Time.local(2006, 8, 8), span.end - end - -end \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_RepeaterFortnight.rb b/framework/Date_Parser/chronic/test/test_RepeaterFortnight.rb deleted file mode 100644 index cb80c43cf..000000000 --- a/framework/Date_Parser/chronic/test/test_RepeaterFortnight.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestRepeaterFortnight < Test::Unit::TestCase - - def setup - @now = Time.local(2006, 8, 16, 14, 0, 0, 0) - end - - def test_next_future - fortnights = Chronic::RepeaterFortnight.new(:fortnight) - fortnights.start = @now - - next_fortnight = fortnights.next(:future) - assert_equal Time.local(2006, 8, 20), next_fortnight.begin - assert_equal Time.local(2006, 9, 3), next_fortnight.end - - next_next_fortnight = fortnights.next(:future) - assert_equal Time.local(2006, 9, 3), next_next_fortnight.begin - assert_equal Time.local(2006, 9, 17), next_next_fortnight.end - end - - def test_next_past - fortnights = Chronic::RepeaterFortnight.new(:fortnight) - fortnights.start = @now - - last_fortnight = fortnights.next(:past) - assert_equal Time.local(2006, 7, 30), last_fortnight.begin - assert_equal Time.local(2006, 8, 13), last_fortnight.end - - last_last_fortnight = fortnights.next(:past) - assert_equal Time.local(2006, 7, 16), last_last_fortnight.begin - assert_equal Time.local(2006, 7, 30), last_last_fortnight.end - end - - def test_this_future - fortnights = Chronic::RepeaterFortnight.new(:fortnight) - fortnights.start = @now - - this_fortnight = fortnights.this(:future) - assert_equal Time.local(2006, 8, 16, 15), this_fortnight.begin - assert_equal Time.local(2006, 8, 27), this_fortnight.end - end - - def test_this_past - fortnights = Chronic::RepeaterFortnight.new(:fortnight) - fortnights.start = @now - - this_fortnight = fortnights.this(:past) - assert_equal Time.local(2006, 8, 13, 0), this_fortnight.begin - assert_equal Time.local(2006, 8, 16, 14), this_fortnight.end - end - - def test_offset - span = Chronic::Span.new(@now, @now + 1) - - offset_span = Chronic::RepeaterWeek.new(:week).offset(span, 3, :future) - - assert_equal Time.local(2006, 9, 6, 14), offset_span.begin - assert_equal Time.local(2006, 9, 6, 14, 0, 1), offset_span.end - end - -end \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_RepeaterHour.rb b/framework/Date_Parser/chronic/test/test_RepeaterHour.rb deleted file mode 100644 index 48f37c429..000000000 --- a/framework/Date_Parser/chronic/test/test_RepeaterHour.rb +++ /dev/null @@ -1,65 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestRepeaterHour < Test::Unit::TestCase - - def setup - @now = Time.local(2006, 8, 16, 14, 0, 0, 0) - end - - def test_next_future - hours = Chronic::RepeaterHour.new(:hour) - hours.start = @now - - next_hour = hours.next(:future) - assert_equal Time.local(2006, 8, 16, 15), next_hour.begin - assert_equal Time.local(2006, 8, 16, 16), next_hour.end - - next_next_hour = hours.next(:future) - assert_equal Time.local(2006, 8, 16, 16), next_next_hour.begin - assert_equal Time.local(2006, 8, 16, 17), next_next_hour.end - end - - def test_next_past - hours = Chronic::RepeaterHour.new(:hour) - hours.start = @now - - past_hour = hours.next(:past) - assert_equal Time.local(2006, 8, 16, 13), past_hour.begin - assert_equal Time.local(2006, 8, 16, 14), past_hour.end - - past_past_hour = hours.next(:past) - assert_equal Time.local(2006, 8, 16, 12), past_past_hour.begin - assert_equal Time.local(2006, 8, 16, 13), past_past_hour.end - end - - def test_this - @now = Time.local(2006, 8, 16, 14, 30) - - hours = Chronic::RepeaterHour.new(:hour) - hours.start = @now - - this_hour = hours.this(:future) - assert_equal Time.local(2006, 8, 16, 14, 31), this_hour.begin - assert_equal Time.local(2006, 8, 16, 15), this_hour.end - - this_hour = hours.this(:past) - assert_equal Time.local(2006, 8, 16, 14), this_hour.begin - assert_equal Time.local(2006, 8, 16, 14, 30), this_hour.end - end - - def test_offset - span = Chronic::Span.new(@now, @now + 1) - - offset_span = Chronic::RepeaterHour.new(:hour).offset(span, 3, :future) - - assert_equal Time.local(2006, 8, 16, 17), offset_span.begin - assert_equal Time.local(2006, 8, 16, 17, 0, 1), offset_span.end - - offset_span = Chronic::RepeaterHour.new(:hour).offset(span, 24, :past) - - assert_equal Time.local(2006, 8, 15, 14), offset_span.begin - assert_equal Time.local(2006, 8, 15, 14, 0, 1), offset_span.end - end - -end \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_RepeaterMonth.rb b/framework/Date_Parser/chronic/test/test_RepeaterMonth.rb deleted file mode 100644 index d0609c5f0..000000000 --- a/framework/Date_Parser/chronic/test/test_RepeaterMonth.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestRepeaterMonth < Test::Unit::TestCase - - def setup - # Wed Aug 16 14:00:00 2006 - @now = Time.local(2006, 8, 16, 14, 0, 0, 0) - end - - def test_offset_by - # future - - time = Chronic::RepeaterMonth.new(:month).offset_by(@now, 1, :future) - assert_equal Time.local(2006, 9, 16, 14), time - - time = Chronic::RepeaterMonth.new(:month).offset_by(@now, 5, :future) - assert_equal Time.local(2007, 1, 16, 14), time - - # past - - time = Chronic::RepeaterMonth.new(:month).offset_by(@now, 1, :past) - assert_equal Time.local(2006, 7, 16, 14), time - - time = Chronic::RepeaterMonth.new(:month).offset_by(@now, 10, :past) - assert_equal Time.local(2005, 10, 16, 14), time - end - - def test_offset - # future - - span = Chronic::Span.new(@now, @now + 60) - offset_span = Chronic::RepeaterMonth.new(:month).offset(span, 1, :future) - - assert_equal Time.local(2006, 9, 16, 14), offset_span.begin - assert_equal Time.local(2006, 9, 16, 14, 1), offset_span.end - - # past - - span = Chronic::Span.new(@now, @now + 60) - offset_span = Chronic::RepeaterMonth.new(:month).offset(span, 1, :past) - - assert_equal Time.local(2006, 7, 16, 14), offset_span.begin - assert_equal Time.local(2006, 7, 16, 14, 1), offset_span.end - end - -end \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_RepeaterMonthName.rb b/framework/Date_Parser/chronic/test/test_RepeaterMonthName.rb deleted file mode 100644 index 6326a4587..000000000 --- a/framework/Date_Parser/chronic/test/test_RepeaterMonthName.rb +++ /dev/null @@ -1,57 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestRepeaterMonthName < Test::Unit::TestCase - - def setup - # Wed Aug 16 14:00:00 2006 - @now = Time.local(2006, 8, 16, 14, 0, 0, 0) - end - - def test_next - # future - - mays = Chronic::RepeaterMonthName.new(:may) - mays.start = @now - - next_may = mays.next(:future) - assert_equal Time.local(2007, 5), next_may.begin - assert_equal Time.local(2007, 6), next_may.end - - next_next_may = mays.next(:future) - assert_equal Time.local(2008, 5), next_next_may.begin - assert_equal Time.local(2008, 6), next_next_may.end - - decembers = Chronic::RepeaterMonthName.new(:december) - decembers.start = @now - - next_december = decembers.next(:future) - assert_equal Time.local(2006, 12), next_december.begin - assert_equal Time.local(2007, 1), next_december.end - - # past - - mays = Chronic::RepeaterMonthName.new(:may) - mays.start = @now - - assert_equal Time.local(2006, 5), mays.next(:past).begin - assert_equal Time.local(2005, 5), mays.next(:past).begin - end - - def test_this - octobers = Chronic::RepeaterMonthName.new(:october) - octobers.start = @now - - this_october = octobers.this(:future) - assert_equal Time.local(2006, 10, 1), this_october.begin - assert_equal Time.local(2006, 11, 1), this_october.end - - aprils = Chronic::RepeaterMonthName.new(:april) - aprils.start = @now - - this_april = aprils.this(:past) - assert_equal Time.local(2006, 4, 1), this_april.begin - assert_equal Time.local(2006, 5, 1), this_april.end - end - -end \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_RepeaterTime.rb b/framework/Date_Parser/chronic/test/test_RepeaterTime.rb deleted file mode 100644 index bb2773588..000000000 --- a/framework/Date_Parser/chronic/test/test_RepeaterTime.rb +++ /dev/null @@ -1,72 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestRepeaterTime < Test::Unit::TestCase - - def setup - # Wed Aug 16 14:00:00 2006 - @now = Time.local(2006, 8, 16, 14, 0, 0, 0) - end - - def test_next_future - t = Chronic::RepeaterTime.new('4:00') - t.start = @now - - assert_equal Time.local(2006, 8, 16, 16), t.next(:future).begin - assert_equal Time.local(2006, 8, 17, 4), t.next(:future).begin - - t = Chronic::RepeaterTime.new('13:00') - t.start = @now - - assert_equal Time.local(2006, 8, 17, 13), t.next(:future).begin - assert_equal Time.local(2006, 8, 18, 13), t.next(:future).begin - - t = Chronic::RepeaterTime.new('0400') - t.start = @now - - assert_equal Time.local(2006, 8, 17, 4), t.next(:future).begin - assert_equal Time.local(2006, 8, 18, 4), t.next(:future).begin - end - - def test_next_past - t = Chronic::RepeaterTime.new('4:00') - t.start = @now - - assert_equal Time.local(2006, 8, 16, 4), t.next(:past).begin - assert_equal Time.local(2006, 8, 15, 16), t.next(:past).begin - - t = Chronic::RepeaterTime.new('13:00') - t.start = @now - - assert_equal Time.local(2006, 8, 16, 13), t.next(:past).begin - assert_equal Time.local(2006, 8, 15, 13), t.next(:past).begin - end - - def test_type - t1 = Chronic::RepeaterTime.new('4') - assert_equal 14_400, t1.type.time - - t1 = Chronic::RepeaterTime.new('14') - assert_equal 50_400, t1.type.time - - t1 = Chronic::RepeaterTime.new('4:00') - assert_equal 14_400, t1.type.time - - t1 = Chronic::RepeaterTime.new('4:30') - assert_equal 16_200, t1.type.time - - t1 = Chronic::RepeaterTime.new('1400') - assert_equal 50_400, t1.type.time - - t1 = Chronic::RepeaterTime.new('0400') - assert_equal 14_400, t1.type.time - - t1 = Chronic::RepeaterTime.new('04') - assert_equal 14_400, t1.type.time - - t1 = Chronic::RepeaterTime.new('400') - assert_equal 14_400, t1.type.time - end - - -end \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_RepeaterWeek.rb b/framework/Date_Parser/chronic/test/test_RepeaterWeek.rb deleted file mode 100644 index 084ef4ee6..000000000 --- a/framework/Date_Parser/chronic/test/test_RepeaterWeek.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestRepeaterWeek < Test::Unit::TestCase - - def setup - @now = Time.local(2006, 8, 16, 14, 0, 0, 0) - end - - def test_next_future - weeks = Chronic::RepeaterWeek.new(:week) - weeks.start = @now - - next_week = weeks.next(:future) - assert_equal Time.local(2006, 8, 20), next_week.begin - assert_equal Time.local(2006, 8, 27), next_week.end - - next_next_week = weeks.next(:future) - assert_equal Time.local(2006, 8, 27), next_next_week.begin - assert_equal Time.local(2006, 9, 3), next_next_week.end - end - - def test_next_past - weeks = Chronic::RepeaterWeek.new(:week) - weeks.start = @now - - last_week = weeks.next(:past) - assert_equal Time.local(2006, 8, 6), last_week.begin - assert_equal Time.local(2006, 8, 13), last_week.end - - last_last_week = weeks.next(:past) - assert_equal Time.local(2006, 7, 30), last_last_week.begin - assert_equal Time.local(2006, 8, 6), last_last_week.end - end - - def test_this_future - weeks = Chronic::RepeaterWeek.new(:week) - weeks.start = @now - - this_week = weeks.this(:future) - assert_equal Time.local(2006, 8, 16, 15), this_week.begin - assert_equal Time.local(2006, 8, 20), this_week.end - end - - def test_this_past - weeks = Chronic::RepeaterWeek.new(:week) - weeks.start = @now - - this_week = weeks.this(:past) - assert_equal Time.local(2006, 8, 13, 0), this_week.begin - assert_equal Time.local(2006, 8, 16, 14), this_week.end - end - - def test_offset - span = Chronic::Span.new(@now, @now + 1) - - offset_span = Chronic::RepeaterWeek.new(:week).offset(span, 3, :future) - - assert_equal Time.local(2006, 9, 6, 14), offset_span.begin - assert_equal Time.local(2006, 9, 6, 14, 0, 1), offset_span.end - end - -end \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_RepeaterWeekend.rb b/framework/Date_Parser/chronic/test/test_RepeaterWeekend.rb deleted file mode 100644 index 44dc08763..000000000 --- a/framework/Date_Parser/chronic/test/test_RepeaterWeekend.rb +++ /dev/null @@ -1,75 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestRepeaterWeekend < Test::Unit::TestCase - - def setup - # Wed Aug 16 14:00:00 2006 - @now = Time.local(2006, 8, 16, 14, 0, 0, 0) - end - - def test_next_future - weekend = Chronic::RepeaterWeekend.new(:weekend) - weekend.start = @now - - next_weekend = weekend.next(:future) - assert_equal Time.local(2006, 8, 19), next_weekend.begin - assert_equal Time.local(2006, 8, 21), next_weekend.end - end - - def test_next_past - weekend = Chronic::RepeaterWeekend.new(:weekend) - weekend.start = @now - - next_weekend = weekend.next(:past) - assert_equal Time.local(2006, 8, 12), next_weekend.begin - assert_equal Time.local(2006, 8, 14), next_weekend.end - end - - def test_this_future - weekend = Chronic::RepeaterWeekend.new(:weekend) - weekend.start = @now - - next_weekend = weekend.this(:future) - assert_equal Time.local(2006, 8, 19), next_weekend.begin - assert_equal Time.local(2006, 8, 21), next_weekend.end - end - - def test_this_past - weekend = Chronic::RepeaterWeekend.new(:weekend) - weekend.start = @now - - next_weekend = weekend.this(:past) - assert_equal Time.local(2006, 8, 12), next_weekend.begin - assert_equal Time.local(2006, 8, 14), next_weekend.end - end - - def test_this_none - weekend = Chronic::RepeaterWeekend.new(:weekend) - weekend.start = @now - - next_weekend = weekend.this(:future) - assert_equal Time.local(2006, 8, 19), next_weekend.begin - assert_equal Time.local(2006, 8, 21), next_weekend.end - end - - def test_offset - span = Chronic::Span.new(@now, @now + 1) - - offset_span = Chronic::RepeaterWeekend.new(:weekend).offset(span, 3, :future) - - assert_equal Time.local(2006, 9, 2), offset_span.begin - assert_equal Time.local(2006, 9, 2, 0, 0, 1), offset_span.end - - offset_span = Chronic::RepeaterWeekend.new(:weekend).offset(span, 1, :past) - - assert_equal Time.local(2006, 8, 12), offset_span.begin - assert_equal Time.local(2006, 8, 12, 0, 0, 1), offset_span.end - - offset_span = Chronic::RepeaterWeekend.new(:weekend).offset(span, 0, :future) - - assert_equal Time.local(2006, 8, 12), offset_span.begin - assert_equal Time.local(2006, 8, 12, 0, 0, 1), offset_span.end - end - -end \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_RepeaterYear.rb b/framework/Date_Parser/chronic/test/test_RepeaterYear.rb deleted file mode 100644 index eaebe25a2..000000000 --- a/framework/Date_Parser/chronic/test/test_RepeaterYear.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestRepeaterYear < Test::Unit::TestCase - - def setup - @now = Time.local(2006, 8, 16, 14, 0, 0, 0) - end - - def test_next_future - years = Chronic::RepeaterYear.new(:year) - years.start = @now - - next_year = years.next(:future) - assert_equal Time.local(2007, 1, 1), next_year.begin - assert_equal Time.local(2008, 1, 1), next_year.end - - next_next_year = years.next(:future) - assert_equal Time.local(2008, 1, 1), next_next_year.begin - assert_equal Time.local(2009, 1, 1), next_next_year.end - end - - def test_next_past - years = Chronic::RepeaterYear.new(:year) - years.start = @now - - last_year = years.next(:past) - assert_equal Time.local(2005, 1, 1), last_year.begin - assert_equal Time.local(2006, 1, 1), last_year.end - - last_last_year = years.next(:past) - assert_equal Time.local(2004, 1, 1), last_last_year.begin - assert_equal Time.local(2005, 1, 1), last_last_year.end - end - - def test_this - years = Chronic::RepeaterYear.new(:year) - years.start = @now - - this_year = years.this(:future) - assert_equal Time.local(2006, 8, 17), this_year.begin - assert_equal Time.local(2007, 1, 1), this_year.end - - this_year = years.this(:past) - assert_equal Time.local(2006, 1, 1), this_year.begin - assert_equal Time.local(2006, 8, 16), this_year.end - end - - def test_offset - span = Chronic::Span.new(@now, @now + 1) - - offset_span = Chronic::RepeaterYear.new(:year).offset(span, 3, :future) - - assert_equal Time.local(2009, 8, 16, 14), offset_span.begin - assert_equal Time.local(2009, 8, 16, 14, 0, 1), offset_span.end - - offset_span = Chronic::RepeaterYear.new(:year).offset(span, 10, :past) - - assert_equal Time.local(1996, 8, 16, 14), offset_span.begin - assert_equal Time.local(1996, 8, 16, 14, 0, 1), offset_span.end - end - -end \ No newline at end of file diff --git a/framework/Date_Parser/chronic/test/test_Time.rb b/framework/Date_Parser/chronic/test/test_Time.rb deleted file mode 100644 index 3ffc9c019..000000000 --- a/framework/Date_Parser/chronic/test/test_Time.rb +++ /dev/null @@ -1,50 +0,0 @@ -require 'chronic' -require 'test/unit' - -class TestTime < Test::Unit::TestCase - - def setup - end - - def test_normal - assert_equal Time.local(2006, 1, 2, 0, 0, 0), Time.construct(2006, 1, 2, 0, 0, 0) - assert_equal Time.local(2006, 1, 2, 3, 0, 0), Time.construct(2006, 1, 2, 3, 0, 0) - assert_equal Time.local(2006, 1, 2, 3, 4, 0), Time.construct(2006, 1, 2, 3, 4, 0) - assert_equal Time.local(2006, 1, 2, 3, 4, 5), Time.construct(2006, 1, 2, 3, 4, 5) - end - - def test_second_overflow - assert_equal Time.local(2006, 1, 1, 0, 1, 30), Time.construct(2006, 1, 1, 0, 0, 90) - assert_equal Time.local(2006, 1, 1, 0, 5, 0), Time.construct(2006, 1, 1, 0, 0, 300) - end - - def test_minute_overflow - assert_equal Time.local(2006, 1, 1, 1, 30), Time.construct(2006, 1, 1, 0, 90) - assert_equal Time.local(2006, 1, 1, 5), Time.construct(2006, 1, 1, 0, 300) - end - - def test_hour_overflow - assert_equal Time.local(2006, 1, 2, 12), Time.construct(2006, 1, 1, 36) - assert_equal Time.local(2006, 1, 7), Time.construct(2006, 1, 1, 144) - end - - def test_day_overflow - assert_equal Time.local(2006, 2, 1), Time.construct(2006, 1, 32) - assert_equal Time.local(2006, 3, 5), Time.construct(2006, 2, 33) - assert_equal Time.local(2004, 3, 4), Time.construct(2004, 2, 33) - assert_equal Time.local(2000, 3, 5), Time.construct(2000, 2, 33) - - assert_nothing_raised do - Time.construct(2006, 1, 56) - end - - assert_raise(RuntimeError) do - Time.construct(2006, 1, 57) - end - end - - def test_month_overflow - assert_equal Time.local(2006, 1), Time.construct(2005, 13) - assert_equal Time.local(2005, 12), Time.construct(2000, 72) - end -end \ No newline at end of file