summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-26 09:30:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-26 09:30:08 +0000
commit00d61f1fe52b7637e93dde5a7c55cb2138a88405 (patch)
tree2d17d3b8173bd39996f1ad4688420c5a489298a6 /test/ruby
parent34df0e5c9f82a604e3448757e580bd7a75169596 (diff)
* vm_insnhelper.c (vm_call_method): __send__ can call protected
methods. [ruby-core:24500] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_module.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 99b9849..066dd86 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -104,12 +104,15 @@ class TestModule < Test::Unit::TestCase
private_class_method :cm1, "cm3"
def aClass
+ :aClass
end
def aClass1
+ :aClass1
end
def aClass2
+ :aClass2
end
private :aClass1
@@ -118,15 +121,18 @@ class TestModule < Test::Unit::TestCase
class BClass < AClass
def bClass1
+ :bClass1
end
private
def bClass2
+ :bClass2
end
protected
def bClass3
+ :bClass3
end
end
@@ -489,7 +495,7 @@ class TestModule < Test::Unit::TestCase
c = Class.new
assert_raise(NameError) do
- c.instance_eval { attr_reader :"$" }
+ c.instance_eval { attr_reader :"." }
end
end
@@ -721,4 +727,18 @@ class TestModule < Test::Unit::TestCase
}.call
end
end
+
+ def test_send
+ a = AClass.new
+ assert_equal(:aClass, a.__send__(:aClass))
+ assert_equal(:aClass1, a.__send__(:aClass1))
+ assert_equal(:aClass2, a.__send__(:aClass2))
+ b = BClass.new
+ assert_equal(:aClass, b.__send__(:aClass))
+ assert_equal(:aClass1, b.__send__(:aClass1))
+ assert_equal(:aClass2, b.__send__(:aClass2))
+ assert_equal(:bClass1, b.__send__(:bClass1))
+ assert_equal(:bClass2, b.__send__(:bClass2))
+ assert_equal(:bClass3, b.__send__(:bClass3))
+ end
end