aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--object.c2
-rw-r--r--test/ruby/test_object.rb6
-rw-r--r--test/rubygems/test_gem_specification.rb2
3 files changed, 5 insertions, 5 deletions
diff --git a/object.c b/object.c
index 05bef4df28..7075e13683 100644
--- a/object.c
+++ b/object.c
@@ -423,7 +423,7 @@ rb_obj_dup(VALUE obj)
VALUE dup;
if (rb_special_const_p(obj)) {
- rb_raise(rb_eTypeError, "can't dup %s", rb_obj_classname(obj));
+ return obj;
}
dup = rb_obj_alloc(rb_obj_class(obj));
init_copy(dup, obj);
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb
index 7b3defa011..2f80bc6ffb 100644
--- a/test/ruby/test_object.rb
+++ b/test/ruby/test_object.rb
@@ -19,9 +19,9 @@ class TestObject < Test::Unit::TestCase
end
def test_dup
- assert_raise(TypeError) { 1.dup }
- assert_raise(TypeError) { true.dup }
- assert_raise(TypeError) { nil.dup }
+ assert_equal 1, 1.dup
+ assert_equal true, true.dup
+ assert_equal nil, nil.dup
assert_raise(TypeError) do
Object.new.instance_eval { initialize_copy(1) }
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 87f0f360d7..2c0ea770b5 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1260,7 +1260,7 @@ dependencies: []
s.version = '1'
end
- spec.instance_variable_set :@licenses, :blah
+ spec.instance_variable_set :@licenses, Object.new.singleton_class
spec.loaded_from = '/path/to/file'
e = assert_raises Gem::FormatException do