diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
commit | 5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch) | |
tree | 05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/mutex | |
parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) | |
download | ruby-5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0.tar.gz |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/mutex')
-rw-r--r-- | spec/ruby/core/mutex/lock_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/mutex/sleep_spec.rb | 10 | ||||
-rw-r--r-- | spec/ruby/core/mutex/synchronize_spec.rb | 10 | ||||
-rw-r--r-- | spec/ruby/core/mutex/unlock_spec.rb | 6 |
4 files changed, 15 insertions, 15 deletions
diff --git a/spec/ruby/core/mutex/lock_spec.rb b/spec/ruby/core/mutex/lock_spec.rb index a1a2972d8c..7a39817b11 100644 --- a/spec/ruby/core/mutex/lock_spec.rb +++ b/spec/ruby/core/mutex/lock_spec.rb @@ -14,12 +14,12 @@ describe "Mutex#lock" do it "blocks the caller if already locked" do m = Mutex.new m.lock - lambda { m.lock }.should block_caller + -> { m.lock }.should block_caller end it "does not block the caller if not locked" do m = Mutex.new - lambda { m.lock }.should_not block_caller + -> { m.lock }.should_not block_caller end # Unable to find a specific ticket but behavior change may be diff --git a/spec/ruby/core/mutex/sleep_spec.rb b/spec/ruby/core/mutex/sleep_spec.rb index 72ed397eb5..477f9278c8 100644 --- a/spec/ruby/core/mutex/sleep_spec.rb +++ b/spec/ruby/core/mutex/sleep_spec.rb @@ -4,21 +4,21 @@ describe "Mutex#sleep" do describe "when not locked by the current thread" do it "raises a ThreadError" do m = Mutex.new - lambda { m.sleep }.should raise_error(ThreadError) + -> { m.sleep }.should raise_error(ThreadError) end it "raises an ArgumentError if passed a negative duration" do m = Mutex.new - lambda { m.sleep(-0.1) }.should raise_error(ArgumentError) - lambda { m.sleep(-1) }.should raise_error(ArgumentError) + -> { m.sleep(-0.1) }.should raise_error(ArgumentError) + -> { m.sleep(-1) }.should raise_error(ArgumentError) end end it "raises an ArgumentError if passed a negative duration" do m = Mutex.new m.lock - lambda { m.sleep(-0.1) }.should raise_error(ArgumentError) - lambda { m.sleep(-1) }.should raise_error(ArgumentError) + -> { m.sleep(-0.1) }.should raise_error(ArgumentError) + -> { m.sleep(-1) }.should raise_error(ArgumentError) end it "pauses execution for approximately the duration requested" do diff --git a/spec/ruby/core/mutex/synchronize_spec.rb b/spec/ruby/core/mutex/synchronize_spec.rb index e3dad508b8..7942885197 100644 --- a/spec/ruby/core/mutex/synchronize_spec.rb +++ b/spec/ruby/core/mutex/synchronize_spec.rb @@ -8,7 +8,7 @@ describe "Mutex#synchronize" do synchronized = false th = Thread.new do - lambda do + -> do m1.synchronize do synchronized = true m2.lock @@ -28,12 +28,12 @@ describe "Mutex#synchronize" do it "blocks the caller if already locked" do m = Mutex.new m.lock - lambda { m.synchronize { } }.should block_caller + -> { m.synchronize { } }.should block_caller end it "does not block the caller if not locked" do m = Mutex.new - lambda { m.synchronize { } }.should_not block_caller + -> { m.synchronize { } }.should_not block_caller end it "blocks the caller if another thread is also in the synchronize block" do @@ -50,7 +50,7 @@ describe "Mutex#synchronize" do q1.pop.should == :ready - lambda { m.synchronize { } }.should block_caller + -> { m.synchronize { } }.should block_caller q2.push :done t.join @@ -60,7 +60,7 @@ describe "Mutex#synchronize" do m = Mutex.new m.synchronize do - lambda { m.synchronize { } }.should raise_error(ThreadError) + -> { m.synchronize { } }.should raise_error(ThreadError) end end end diff --git a/spec/ruby/core/mutex/unlock_spec.rb b/spec/ruby/core/mutex/unlock_spec.rb index 12353f9ba3..c9c3bfe14f 100644 --- a/spec/ruby/core/mutex/unlock_spec.rb +++ b/spec/ruby/core/mutex/unlock_spec.rb @@ -3,7 +3,7 @@ require_relative '../../spec_helper' describe "Mutex#unlock" do it "raises ThreadError unless Mutex is locked" do mutex = Mutex.new - lambda { mutex.unlock }.should raise_error(ThreadError) + -> { mutex.unlock }.should raise_error(ThreadError) end it "raises ThreadError unless thread owns Mutex" do @@ -19,7 +19,7 @@ describe "Mutex#unlock" do Thread.pass until mutex.locked? Thread.pass while th.status and th.status != "sleep" - lambda { mutex.unlock }.should raise_error(ThreadError) + -> { mutex.unlock }.should raise_error(ThreadError) wait.unlock th.join @@ -33,6 +33,6 @@ describe "Mutex#unlock" do th.join - lambda { mutex.unlock }.should raise_error(ThreadError) + -> { mutex.unlock }.should raise_error(ThreadError) end end |