-
-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specs for Queue#freeze and SizedQueue#freeze
References: * https://rubyreferences.github.io/rubychanges/3.3.html#threadqueuefreeze-and-sizedqueuefreeze-raise-typeerror * https://bugs.ruby-lang.org/issues/17146 * https://docs.ruby-lang.org/en/3.3/Thread/Queue.html#method-i-freeze * https://docs.ruby-lang.org/en/3.3/Thread/SizedQueue.html#method-i-freeze
- Loading branch information
1 parent
e7233f3
commit 8a83b70
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require_relative '../../spec_helper' | ||
require_relative '../../shared/queue/freeze' | ||
|
||
describe "Queue#freeze" do | ||
it_behaves_like :queue_freeze, :freeze, -> { Queue.new } | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require_relative '../../spec_helper' | ||
require_relative '../../shared/queue/freeze' | ||
|
||
describe "SizedQueue#freeze" do | ||
it_behaves_like :queue_freeze, :freeze, -> { SizedQueue.new(1) } | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
describe :queue_freeze, shared: true do | ||
ruby_version_is ""..."3.3" do | ||
it "can be frozen" do | ||
queue = @object.call | ||
queue.freeze | ||
queue.should.frozen? | ||
end | ||
end | ||
|
||
ruby_version_is "3.3" do | ||
it "raises an exception when freezing" do | ||
queue = @object.call | ||
-> { | ||
queue.freeze | ||
}.should raise_error(TypeError, "cannot freeze #{queue}") | ||
end | ||
end | ||
end |