mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
* class.c (rb_mod_init_copy): Clear the cached inspect string of a
dup'd anonymous module or class. [ruby-trunk - Bug #6454] * test/ruby/test_module.rb (class TestModule): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cb61ea5ef3
commit
1d4e7d9232
3 changed files with 33 additions and 0 deletions
|
@ -259,6 +259,31 @@ class TestModule < Test::Unit::TestCase
|
|||
assert_equal([:MIXIN, :USER], User.constants.sort)
|
||||
end
|
||||
|
||||
def test_dup
|
||||
bug6454 = '[ruby-core:45132]'
|
||||
|
||||
a = Module.new
|
||||
Other.const_set :BUG6454, a
|
||||
|
||||
original = Other::BUG6454.inspect
|
||||
|
||||
b = a.dup
|
||||
Other.const_set :BUG6454_dup, b
|
||||
|
||||
assert_equal "TestModule::Other::BUG6454_dup", b.inspect, bug6454
|
||||
end
|
||||
|
||||
def test_dup_anonymous
|
||||
bug6454 = '[ruby-core:45132]'
|
||||
|
||||
a = Module.new
|
||||
original = a.inspect
|
||||
|
||||
b = a.dup
|
||||
|
||||
refute_equal original, b.inspect, bug6454
|
||||
end
|
||||
|
||||
def test_included_modules
|
||||
assert_equal([], Mixin.included_modules)
|
||||
assert_equal([Mixin], User.included_modules)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue