aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/thread/value_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/thread/value_spec.rb')
-rw-r--r--spec/ruby/core/thread/value_spec.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/ruby/core/thread/value_spec.rb b/spec/ruby/core/thread/value_spec.rb
index 30b12db125..30e43abd1a 100644
--- a/spec/ruby/core/thread/value_spec.rb
+++ b/spec/ruby/core/thread/value_spec.rb
@@ -11,11 +11,21 @@ describe "Thread#value" do
Thread.current.report_on_exception = false
raise "Hello"
}
- lambda { t.value }.should raise_error(RuntimeError, "Hello")
+ -> { t.value }.should raise_error(RuntimeError, "Hello")
end
it "is nil for a killed thread" do
t = Thread.new { Thread.current.exit }
t.value.should == nil
end
+
+ it "returns when the thread finished" do
+ q = Queue.new
+ t = Thread.new {
+ q.pop
+ }
+ -> { t.value }.should block_caller
+ q.push :result
+ t.value.should == :result
+ end
end