mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
freeze all Range objects.
Matz want to try to freeze all Range objects. [Feature #15504]
This commit is contained in:
parent
f4328d7f5d
commit
0096d2b895
Notes:
git
2020-09-25 22:17:22 +09:00
7 changed files with 22 additions and 10 deletions
|
@ -28,8 +28,13 @@ describe "Range#initialize" do
|
|||
end
|
||||
|
||||
it "raises a NameError if called on an already initialized Range" do
|
||||
-> { (0..1).send(:initialize, 1, 3) }.should raise_error(NameError)
|
||||
-> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(NameError)
|
||||
if (0..1).frozen? # Ruby 3.0-
|
||||
-> { (0..1).send(:initialize, 1, 3) }.should raise_error(FrozenError)
|
||||
-> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(FrozenError)
|
||||
else
|
||||
-> { (0..1).send(:initialize, 1, 3) }.should raise_error(NameError)
|
||||
-> { (0..1).send(:initialize, 1, 3, true) }.should raise_error(NameError)
|
||||
end
|
||||
end
|
||||
|
||||
it "raises an ArgumentError if arguments don't respond to <=>" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue