mirror of
https://github.com/ruby/ruby.git
synced 2025-09-24 04:54:01 +02:00
* test/ruby/test_require.rb: new tests for library requiring, to
achieve over 90% test coverage of dln.c. * test/ruby/test_class.rb: add tests to achieve over 90% test coverage of class.c. * test/ruby/test_module.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4c094940aa
commit
2c8dd794e9
4 changed files with 285 additions and 0 deletions
|
@ -690,4 +690,23 @@ class TestModule < Test::Unit::TestCase
|
|||
o.extend(m2)
|
||||
assert_equal(true, o.respond_to?(:foo))
|
||||
end
|
||||
|
||||
def test_cyclic_include
|
||||
m1 = Module.new
|
||||
m2 = Module.new
|
||||
m1.instance_eval { include(m2) }
|
||||
assert_raise(ArgumentError) do
|
||||
m2.instance_eval { include(m1) }
|
||||
end
|
||||
end
|
||||
|
||||
def test_include_p
|
||||
m = Module.new
|
||||
c1 = Class.new
|
||||
c1.instance_eval { include(m) }
|
||||
c2 = Class.new(c1)
|
||||
assert_equal(true, c1.include?(m))
|
||||
assert_equal(true, c2.include?(m))
|
||||
assert_equal(false, m.include?(m))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue