diff options
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r-- | test/ruby/test_method.rb | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 83e499913a..56e94493d9 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -199,11 +199,6 @@ class TestMethod < Test::Unit::TestCase assert_equal(o.method(:foo), o.method(:foo)) assert_equal(o.method(:foo), o.method(:bar)) assert_not_equal(o.method(:foo), o.method(:baz)) - - class << o - private :bar - end - assert_not_equal(o.method(:foo), o.method(:bar)) end def test_hash @@ -330,8 +325,8 @@ class TestMethod < Test::Unit::TestCase def PUBLIC_SINGLETON_TEST.def; end end def test_define_singleton_method_public - assert_equal(true, PUBLIC_SINGLETON_TEST.method(:dsm).public?) - assert_equal(true, PUBLIC_SINGLETON_TEST.method(:def).public?) + assert_nil(PUBLIC_SINGLETON_TEST.dsm) + assert_nil(PUBLIC_SINGLETON_TEST.def) end def test_define_singleton_method_no_proc @@ -1197,50 +1192,6 @@ class TestMethod < Test::Unit::TestCase assert_nil(super_method) end - def test_method_visibility_predicates - v = Visibility.new - assert_equal(true, v.method(:mv1).public?) - assert_equal(true, v.method(:mv2).private?) - assert_equal(true, v.method(:mv3).protected?) - assert_equal(false, v.method(:mv2).public?) - assert_equal(false, v.method(:mv3).private?) - assert_equal(false, v.method(:mv1).protected?) - end - - def test_unbound_method_visibility_predicates - assert_equal(true, Visibility.instance_method(:mv1).public?) - assert_equal(true, Visibility.instance_method(:mv2).private?) - assert_equal(true, Visibility.instance_method(:mv3).protected?) - assert_equal(false, Visibility.instance_method(:mv2).public?) - assert_equal(false, Visibility.instance_method(:mv3).private?) - assert_equal(false, Visibility.instance_method(:mv1).protected?) - end - - class VisibilitySub < Visibility - protected :mv1 - public :mv2 - private :mv3 - end - - def test_method_visibility_predicates_with_subclass_visbility_change - v = VisibilitySub.new - assert_equal(false, v.method(:mv1).public?) - assert_equal(false, v.method(:mv2).private?) - assert_equal(false, v.method(:mv3).protected?) - assert_equal(true, v.method(:mv2).public?) - assert_equal(true, v.method(:mv3).private?) - assert_equal(true, v.method(:mv1).protected?) - end - - def test_unbound_method_visibility_predicates_with_subclass_visbility_change - assert_equal(false, VisibilitySub.instance_method(:mv1).public?) - assert_equal(false, VisibilitySub.instance_method(:mv2).private?) - assert_equal(false, VisibilitySub.instance_method(:mv3).protected?) - assert_equal(true, VisibilitySub.instance_method(:mv2).public?) - assert_equal(true, VisibilitySub.instance_method(:mv3).private?) - assert_equal(true, VisibilitySub.instance_method(:mv1).protected?) - end - def rest_parameter(*rest) rest end |