summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-22 02:02:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-22 02:02:11 +0000
commit31ef3124a9db534abcc3e323f5d3cb696eda3bf5 (patch)
treeb1c6f0327fb570019586b007bcce785d6c495b99 /test
parent4096f39dcf41628d2248ac2a7dcbd9f45751946a (diff)
downloadruby-31ef3124a9db534abcc3e323f5d3cb696eda3bf5.tar.gz
numeric.c: Numeric#clone and #dup
* numeric.c (num_clone, num_dup): no longer raises TypeError, returns the receiver instead as well as Integer and Float. [ruby-core:79636] [Bug #13237] * object.c (rb_immutable_obj_clone): immutable object clone with freeze optional keyword argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_numeric.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb
index eb056f61c3..163d65334c 100644
--- a/test/ruby/test_numeric.rb
+++ b/test/ruby/test_numeric.rb
@@ -76,12 +76,18 @@ class TestNumeric < Test::Unit::TestCase
def test_dup
a = Numeric.new
- assert_raise(TypeError) { a.dup }
+ assert_same a, a.dup
+ end
+
+ def test_clone
+ a = Numeric.new
+ assert_same a, a.clone
+ assert_raise(ArgumentError) {a.clone(freeze: false)}
- c = Module.new do
- break eval("class C\u{3042} < Numeric; self; end")
+ c = EnvUtil.labeled_class("\u{1f4a9}", Numeric)
+ assert_raise_with_message(ArgumentError, /\u{1f4a9}/) do
+ c.new.clone(freeze: false)
end
- assert_raise_with_message(TypeError, /C\u3042/) {c.new.dup}
end
def test_quo