diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-30 03:36:21 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-30 03:36:21 +0000 |
commit | 8d4dff2c181d5ef81f0aae495c512f8e6622552f (patch) | |
tree | a150676407fcc42d6a0310e963b312593ab5d6f8 /test | |
parent | 6f77d0a3aa1cc09e7d7926bb62b9e076a5048bfa (diff) | |
download | ruby-8d4dff2c181d5ef81f0aae495c512f8e6622552f.tar.gz |
* vm_method.c: added documentation of protected/private methods.
[fix GH-1072]
* test/ruby/test_module.rb: added testcase for method_defined?
[fix GH-1071]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_module.rb | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 358e47af64..19cf418cf1 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -74,6 +74,14 @@ class TestModule < Test::Unit::TestCase include Mixin def user end + + def user2 + end + protected :user2 + + def user3 + end + private :user3 end module Other @@ -442,8 +450,8 @@ class TestModule < Test::Unit::TestCase end def test_instance_methods - assert_equal([:user], User.instance_methods(false)) - assert_equal([:user, :mixin].sort, User.instance_methods(true).sort) + assert_equal([:user, :user2], User.instance_methods(false)) + assert_equal([:user, :user2, :mixin].sort, User.instance_methods(true).sort) assert_equal([:mixin], Mixin.instance_methods) assert_equal([:mixin], Mixin.instance_methods(true)) assert_equal([:cClass], (class << CClass; self; end).instance_methods(false)) @@ -458,12 +466,17 @@ class TestModule < Test::Unit::TestCase end def test_method_defined? - assert_method_not_defined?(User, :wombat) - assert_method_defined?(User, :user) - assert_method_defined?(User, :mixin) - assert_method_not_defined?(User, :wombat) - assert_method_defined?(User, :user) - assert_method_defined?(User, :mixin) + assert !User.method_defined?(:wombat) + assert User.method_defined?(:mixin) + assert User.method_defined?(:user) + assert User.method_defined?(:user2) + assert !User.method_defined?(:user3) + + assert !User.method_defined?("wombat") + assert User.method_defined?("mixin") + assert User.method_defined?("user") + assert User.method_defined?("user2") + assert !User.method_defined?("user3") end def module_exec_aux |