Created
August 19, 2009 07:45
-
-
Save nrk/170232 to your computer and use it in GitHub Desktop.
Testing rufus-scheduler (git 513214a) under IronRuby (git 8d1b9f3c)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/spec/blocking_spec.rb b/spec/blocking_spec.rb | |
| index 3f1b212..a29ad84 100644 | |
| --- a/spec/blocking_spec.rb | |
| +++ b/spec/blocking_spec.rb | |
| @@ -26,29 +26,31 @@ describe SCHEDULER_CLASS do | |
| puts '=' * 80 | |
| p e | |
| puts '=' * 80 | |
| end | |
| end | |
| it 'should not block when :blocking => nil' do | |
| $var = [] | |
| @s.in('1s') { JOB.call(1) } | |
| + sleep 0.001 | |
| @s.in('1s') { JOB.call(2) } | |
| sleep 5.0 | |
| [ %w{ a1 a2 b1 b2 }, %w{ a1 a2 b2 b1 } ].should.include($var) | |
| end | |
| it 'should block when :blocking => true' do | |
| $var = [] | |
| @s.in('1s', :blocking => true) { JOB.call(8) } | |
| + sleep 0.001 | |
| @s.in('1s', :blocking => true) { JOB.call(9) } | |
| sleep 4.5 | |
| $var.should.equal(%w{ a8 b8 a9 b9 }) | |
| end | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rufus-scheduler 2.0.2 (git commit 513214a) | |
| IronRuby 0.9.x (git commit 8d1b9f3c) | |
| * When new OS threads are scheduled for execution, their actual order of | |
| execution is non-deterministic and therefore we may get different results in | |
| the blocking specs from time to time. Adding a sleep between the creation of | |
| the two Job instances, even with a tiny value, alleviates the occurrence of | |
| the above mentioned issue. | |
| * EmScheduler cannot work under IronRuby, we do not have EventMachine. | |
| * There was a bug in Time#at in IronRuby, the local time must be computed on | |
| the resulting value and not on epoch. Fixed on my repository, the fix will | |
| get into IronRuby after code review + pull. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rufus::Scheduler::PlainScheduler | |
| - should override jobs with the same id | |
| Rufus::Scheduler::PlainScheduler#schedule_at | |
| - should have job ids with the class name in it | |
| - should accept integers as 'at' | |
| - should schedule at 'top + 1' | |
| - should trigger immediately jobs in the past | |
| - should unschedule | |
| - should accept tags for jobs | |
| Rufus::Scheduler::AtJob | |
| - should unschedule itself | |
| - should respond to #next_time | |
| Rufus::Scheduler::PlainScheduler | |
| - should not block when :blocking => nil | |
| - should block when :blocking => true | |
| Rufus::CronLine | |
| - should interpret cron strings correctly | |
| Rufus::CronLine#next_time | |
| - should compute next occurence correctly | |
| Rufus::Scheduler::PlainScheduler#cron | |
| - should have job ids with the class name in it | |
| - should cron every second | |
| - should unschedule | |
| - should keep track of cron jobs | |
| - should accept tags for jobs | |
| - should accept job.unschedule within the job | |
| Rufus::Scheduler::CronJob | |
| - should respond to #next_time | |
| Rufus::Scheduler::PlainScheduler#every | |
| - should have job ids with the class name in it | |
| - should compute frequency | |
| - should schedule every 1s | |
| - should be punctilious | |
| - should unschedule | |
| - should accept tags for jobs | |
| - should honour :first_at | |
| - should honour :first_in | |
| - should accept job.unschedule within the job | |
| - should respect :blocking => true | |
| Rufus::Scheduler::EveryJob | |
| - should respond to #next_time | |
| Rufus::Scheduler::PlainScheduler | |
| - should emit exception messages to stdout | |
| - should accept custom handling of exceptions | |
| - should accept overriding #log_exception | |
| Rufus::Scheduler::PlainScheduler#in | |
| - should have job ids with the class name in it | |
| - should track scheduled in jobs | |
| - should schedule in 1 | |
| - should schedule in 1.0 | |
| - should schedule in 1s | |
| - should trigger [almost] immediately jobs in the past | |
| - should not trigger jobs in the past when :discard_past => true | |
| - should unschedule job | |
| - should accept tags for jobs | |
| Rufus::Scheduler::InJob | |
| - should unschedule itself | |
| - should respond to #next_time | |
| rufus/otime | |
| - should parse duration strings | |
| - should generate duration strings | |
| - should compute duration hashes | |
| rufus/otime#at_to_f | |
| - should turn Time at values to float | |
| - should turn String at values to float | |
| - should accept integers | |
| Rufus::Scheduler::Schedulable | |
| - should schedule via :schedulable | |
| - should honour schedulables that reply to :call | |
| Rufus::Scheduler::PlainScheduler | |
| - should stop | |
| - should set a default scheduler thread name | |
| - should set the scheduler thread name | |
| - should accept a custom frequency | |
| Rufus::Scheduler#start_new | |
| - should piggyback EM if present and running | |
| 58 specifications (130 requirements), 0 failures, 0 errors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs | |
| index 461f7c9..efb7b33 100644 | |
| --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs | |
| +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs | |
| @@ -53,18 +53,18 @@ namespace IronRuby.Builtins { | |
| return new DateTime(other.Ticks, other.Kind); | |
| } | |
| [RubyMethod("at", RubyMethodAttributes.PublicSingleton)] | |
| public static DateTime Create(object/*!*/ self, double seconds) { | |
| - return epoch.ToLocalTime().AddSeconds(seconds); | |
| + return epoch.AddSeconds(seconds).ToLocalTime(); | |
| } | |
| [RubyMethod("at", RubyMethodAttributes.PublicSingleton)] | |
| public static DateTime Create(object/*!*/ self, long seconds, long microseconds) { | |
| - long ticks = epoch.ToLocalTime().Ticks + secondsToTicks(seconds) + microsecondsToTicks(microseconds); | |
| - return new DateTime(ticks); | |
| + long ticks = epoch.Ticks + secondsToTicks(seconds) + microsecondsToTicks(microseconds); | |
| + return new DateTime(ticks).ToLocalTime(); | |
| } | |
| #endregion | |
| [RubyMethod("now", RubyMethodAttributes.PublicSingleton)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment