summaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-21 15:31:15 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-21 15:31:15 +0000
commitc9d1ebcf837dc049c913ecc7cfc4e6c3d8337c81 (patch)
treee2557f8521156567643b56776c2818cdfa04e871 /test/ruby/test_module.rb
parent5eb070564bdcb5b381430f50a95fe15ccc251b35 (diff)
downloadruby-c9d1ebcf837dc049c913ecc7cfc4e6c3d8337c81.tar.gz
ruby-c9d1ebcf837dc049c913ecc7cfc4e6c3d8337c81.tar.xz
ruby-c9d1ebcf837dc049c913ecc7cfc4e6c3d8337c81.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@16510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 6b5a6be53..2e9d69af9 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -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