diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-28 10:32:45 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-28 10:32:45 +0000 |
commit | 662fb599b097e51a3a428f35ac3b39c786591df9 (patch) | |
tree | 145065e09ae16772c08748182441531e9b7ea66d /spec/ruby/core/kernel/shared/dup_clone.rb | |
parent | 9c4542dbaa0808de63fed5681a0e514d47d5d10f (diff) | |
download | ruby-662fb599b097e51a3a428f35ac3b39c786591df9.tar.gz |
Add specs for [Feature #13983] Rational and Complex should be frozen
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/kernel/shared/dup_clone.rb')
-rw-r--r-- | spec/ruby/core/kernel/shared/dup_clone.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/ruby/core/kernel/shared/dup_clone.rb b/spec/ruby/core/kernel/shared/dup_clone.rb index 320da8fc38..116989958b 100644 --- a/spec/ruby/core/kernel/shared/dup_clone.rb +++ b/spec/ruby/core/kernel/shared/dup_clone.rb @@ -122,4 +122,28 @@ describe :kernel_dup_clone, shared: true do :my_symbol.send(@method).should == :my_symbol end end + + ruby_version_is ''...'2.5' do + it "raises a TypeError for Complex" do + c = Complex(1.3, 3.1) + lambda { c.send(@method) }.should raise_error(TypeError) + end + + it "raises a TypeError for Rational" do + r = Rational(1, 3) + lambda { r.send(@method) }.should raise_error(TypeError) + end + end + + ruby_version_is '2.5' do + it "returns self for Complex" do + c = Complex(1.3, 3.1) + c.send(@method).should equal c + end + + it "returns self for Rational" do + r = Rational(1, 3) + r.send(@method).should equal r + end + end end |