diff options
Diffstat (limited to 'spec/rubyspec/core/thread')
-rw-r--r-- | spec/rubyspec/core/thread/fixtures/classes.rb | 16 | ||||
-rw-r--r-- | spec/rubyspec/core/thread/inspect_spec.rb | 8 | ||||
-rw-r--r-- | spec/rubyspec/core/thread/status_spec.rb | 6 | ||||
-rw-r--r-- | spec/rubyspec/core/thread/stop_spec.rb | 6 |
4 files changed, 24 insertions, 12 deletions
diff --git a/spec/rubyspec/core/thread/fixtures/classes.rb b/spec/rubyspec/core/thread/fixtures/classes.rb index 7f7bb69a61..b572c8dd82 100644 --- a/spec/rubyspec/core/thread/fixtures/classes.rb +++ b/spec/rubyspec/core/thread/fixtures/classes.rb @@ -111,9 +111,6 @@ module ThreadSpecs status end - def self.status_of_aborting_thread - end - def self.status_of_killed_thread t = Thread.new { sleep } Thread.pass while t.status and t.status != 'sleep' @@ -147,6 +144,19 @@ module ThreadSpecs status end + def self.status_of_dying_thread_after_sleep + status = nil + t = dying_thread_ensures { + Thread.stop + status = Status.new(Thread.current) + } + Thread.pass while t.status and t.status != 'sleep' + t.wakeup + Thread.pass while t.status and t.status == 'sleep' + t.join + status + end + def self.dying_thread_ensures(kill_method_name=:kill) Thread.new do begin diff --git a/spec/rubyspec/core/thread/inspect_spec.rb b/spec/rubyspec/core/thread/inspect_spec.rb index 759f6e756c..95e598eb6a 100644 --- a/spec/rubyspec/core/thread/inspect_spec.rb +++ b/spec/rubyspec/core/thread/inspect_spec.rb @@ -31,12 +31,14 @@ describe "Thread#inspect" do end it "describes a dying sleeping thread" do - ThreadSpecs.status_of_dying_sleeping_thread.status.should include('sleep') + ThreadSpecs.status_of_dying_sleeping_thread.inspect.should include('sleep') end - quarantine! do it "reports aborting on a killed thread" do - ThreadSpecs.status_of_aborting_thread.inspect.should include('aborting') + ThreadSpecs.status_of_dying_running_thread.inspect.should include('aborting') end + + it "reports aborting on a killed thread after sleep" do + ThreadSpecs.status_of_dying_thread_after_sleep.inspect.should include('aborting') end end diff --git a/spec/rubyspec/core/thread/status_spec.rb b/spec/rubyspec/core/thread/status_spec.rb index 00d7a03ab8..3fbc4f888a 100644 --- a/spec/rubyspec/core/thread/status_spec.rb +++ b/spec/rubyspec/core/thread/status_spec.rb @@ -34,9 +34,11 @@ describe "Thread#status" do ThreadSpecs.status_of_dying_sleeping_thread.status.should == 'sleep' end - quarantine! do it "reports aborting on a killed thread" do - ThreadSpecs.status_of_aborting_thread.status.should == 'aborting' + ThreadSpecs.status_of_dying_running_thread.status.should == 'aborting' end + + it "reports aborting on a killed thread after sleep" do + ThreadSpecs.status_of_dying_thread_after_sleep.status.should == 'aborting' end end diff --git a/spec/rubyspec/core/thread/stop_spec.rb b/spec/rubyspec/core/thread/stop_spec.rb index 79be623906..0bc99487fd 100644 --- a/spec/rubyspec/core/thread/stop_spec.rb +++ b/spec/rubyspec/core/thread/stop_spec.rb @@ -48,9 +48,7 @@ describe "Thread#stop?" do ThreadSpecs.status_of_dying_sleeping_thread.stop?.should == true end - quarantine! do - it "reports aborting on a killed thread" do - ThreadSpecs.status_of_aborting_thread.stop?.should == false - end + it "describes a dying thread after sleep" do + ThreadSpecs.status_of_dying_thread_after_sleep.stop?.should == false end end |