summaryrefslogtreecommitdiff
path: root/spec/ruby/optional/capi/thread_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
commit5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch)
tree05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/optional/capi/thread_spec.rb
parenta06301b103371b0b7da8eaca26ba744961769f99 (diff)
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/optional/capi/thread_spec.rb')
-rw-r--r--spec/ruby/optional/capi/thread_spec.rb18
1 files changed, 6 insertions, 12 deletions
diff --git a/spec/ruby/optional/capi/thread_spec.rb b/spec/ruby/optional/capi/thread_spec.rb
index a46290203a..8ff5b48536 100644
--- a/spec/ruby/optional/capi/thread_spec.rb
+++ b/spec/ruby/optional/capi/thread_spec.rb
@@ -70,7 +70,7 @@ describe "C-API Thread function" do
describe "rb_thread_create" do
it "creates a new thread" do
obj = Object.new
- proc = lambda { |x| ScratchPad.record x }
+ proc = -> x { ScratchPad.record x }
thr = @t.rb_thread_create(proc, obj)
thr.should be_kind_of(Thread)
thr.join
@@ -78,20 +78,20 @@ describe "C-API Thread function" do
end
it "handles throwing an exception in the thread" do
- prc = lambda { |x|
+ prc = -> x {
Thread.current.report_on_exception = false
raise "my error"
}
thr = @t.rb_thread_create(prc, nil)
thr.should be_kind_of(Thread)
- lambda {
+ -> {
thr.join
}.should raise_error(RuntimeError, "my error")
end
it "sets the thread's group" do
- thr = @t.rb_thread_create(lambda { |x| }, nil)
+ thr = @t.rb_thread_create(-> x { }, nil)
begin
thread_group = thr.group
thread_group.should be_an_instance_of(ThreadGroup)
@@ -117,10 +117,7 @@ describe "C-API Thread function" do
# Wake it up, causing the unblock function to be run.
thr.wakeup
- # Make sure it stopped
- thr.join(1).should_not be_nil
-
- # And we got a proper value
+ # Make sure it stopped and we got a proper value
thr.value.should be_true
end
@@ -139,10 +136,7 @@ describe "C-API Thread function" do
# Wake it up, causing the unblock function to be run.
thr.wakeup
- # Make sure it stopped
- thr.join(1).should_not be_nil
-
- # And we got a proper value
+ # Make sure it stopped and we got a proper value
thr.value.should be_true
end
end