aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-04 20:36:20 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-04 20:36:20 +0000
commit1eee78b8769f7f01cead3b0782e1ee4ed84e281b (patch)
tree32ac34a556e40ef93a8e4a15f328d36886b4fc45 /test
parented823523e32e8e8a04123ee5b8ec9c0f3de63c02 (diff)
downloadruby-1eee78b8769f7f01cead3b0782e1ee4ed84e281b.tar.gz
* eval.c (rb_f_send): allow send/__send__ to call methods of all
visibility again. we no longer provide __send, __send!. * eval.c (rb_invoke_method): new method to honor private visibility. if it's invoked in a function call style, it calls private methods as well (previous 1.9 send behavior). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/pathname/test_pathname.rb12
-rw-r--r--test/rss/test_content.rb2
-rw-r--r--test/rss/test_dublincore.rb4
-rw-r--r--test/rss/test_syndication.rb2
-rw-r--r--test/rss/test_taxonomy.rb2
-rw-r--r--test/rss/test_trackback.rb2
-rw-r--r--test/ruby/test_alias.rb2
-rw-r--r--test/ruby/test_assignment.rb2
-rw-r--r--test/ruby/test_eval.rb4
-rw-r--r--test/ruby/test_primitive.rb2
-rw-r--r--test/socket/test_socket.rb8
-rw-r--r--test/socket/test_udp.rb4
12 files changed, 20 insertions, 26 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index 4c9c9e1e52..f3a39a015a 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -9,12 +9,6 @@ require 'enumerator'
class TestPathname < Test::Unit::TestCase
- if RUBY_VERSION < "1.9"
- FUNCALL = :__send__
- else
- FUNCALL = :send!
- end
-
def self.define_assertion(name, &block)
@defassert_num ||= {}
@defassert_num[name] ||= 0
@@ -123,7 +117,7 @@ class TestPathname < Test::Unit::TestCase
# has_trailing_separator?(path) -> bool
def has_trailing_separator?(path)
- Pathname.allocate.send(FUNCALL, :has_trailing_separator?, path)
+ Pathname.allocate.__send__(:has_trailing_separator?, path)
end
defassert(:has_trailing_separator?, false, "/")
@@ -132,11 +126,11 @@ class TestPathname < Test::Unit::TestCase
defassert(:has_trailing_separator?, true, "a/")
def add_trailing_separator(path)
- Pathname.allocate.send(FUNCALL, :add_trailing_separator, path)
+ Pathname.allocate.__send__(:add_trailing_separator, path)
end
def del_trailing_separator(path)
- Pathname.allocate.send(FUNCALL, :del_trailing_separator, path)
+ Pathname.allocate.send(__send__, :del_trailing_separator, path)
end
defassert(:del_trailing_separator, "/", "/")
diff --git a/test/rss/test_content.rb b/test/rss/test_content.rb
index 45f834de01..02db59186b 100644
--- a/test/rss/test_content.rb
+++ b/test/rss/test_content.rb
@@ -85,7 +85,7 @@ EOR
excepted = make_element("#{@prefix}:#{name}", {}, value)
meth = "#{RSS::CONTENT_PREFIX}_#{name}_element"
[@rss10, @rss20].each do |rss|
- assert_equal(excepted, rss.items.last.__send!(meth))
+ assert_equal(excepted, rss.items.last.__send__(meth))
end
end
diff --git a/test/rss/test_dublincore.rb b/test/rss/test_dublincore.rb
index 0e049e7910..22b81483f4 100644
--- a/test/rss/test_dublincore.rb
+++ b/test/rss/test_dublincore.rb
@@ -245,7 +245,7 @@ EOR
excepted = "<#{DC_PREFIX}:#{name}>#{value}</#{DC_PREFIX}:#{name}>"
parents.each do |parent_readers|
parent = chain_reader(feed, parent_readers)
- assert_equal(excepted, parent.__send!("dc_#{name}_elements"))
+ assert_equal(excepted, parent.__send__("dc_#{name}_elements"))
end
plural_suffix = dc_plural_suffix(name, check_backward_compatibility)
@@ -257,7 +257,7 @@ EOR
klass_name = "DublinCore#{Utils.to_class_name(name.to_s)}"
klass = DublinCoreModel.const_get(klass_name)
elems << klass.new(parent.__send__("dc_#{name}"))
- assert_equal(excepted, parent.__send!("dc_#{name}_elements"))
+ assert_equal(excepted, parent.__send__("dc_#{name}_elements"))
end
end
diff --git a/test/rss/test_syndication.rb b/test/rss/test_syndication.rb
index 6aaaa43382..abd75e905e 100644
--- a/test/rss/test_syndication.rb
+++ b/test/rss/test_syndication.rb
@@ -107,7 +107,7 @@ EOR
excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>"
@parents.each do |parent|
assert_equal(excepted,
- @rss.__send__(parent).__send!("sy_#{name}_element"))
+ @rss.__send__(parent).__send__("sy_#{name}_element"))
end
end
diff --git a/test/rss/test_taxonomy.rb b/test/rss/test_taxonomy.rb
index 59cb2f0585..5109f3d892 100644
--- a/test/rss/test_taxonomy.rb
+++ b/test/rss/test_taxonomy.rb
@@ -140,7 +140,7 @@ EOR
def test_to_s
@topics_parents.each do |parent|
meth = "taxo_topics_element"
- assert_equal(@topics_node, @rss.__send__(parent).__send!(meth))
+ assert_equal(@topics_node, @rss.__send__(parent).__send__(meth))
end
@topic_nodes.each_with_index do |node, i|
diff --git a/test/rss/test_trackback.rb b/test/rss/test_trackback.rb
index db4f291317..26812d9010 100644
--- a/test/rss/test_trackback.rb
+++ b/test/rss/test_trackback.rb
@@ -114,7 +114,7 @@ EOR
@parents.each do |parent|
meth = "#{RSS::TRACKBACK_PREFIX}_#{name}_element"
meth << "s" if name == :about
- assert_equal(excepted, @rss.__send__(parent).__send!(meth))
+ assert_equal(excepted, @rss.__send__(parent).__send__(meth))
end
end
diff --git a/test/ruby/test_alias.rb b/test/ruby/test_alias.rb
index 4076de051b..d72fe702af 100644
--- a/test/ruby/test_alias.rb
+++ b/test/ruby/test_alias.rb
@@ -56,7 +56,7 @@ class TestAlias < Test::Unit::TestCase
d = lambda {
$SAFE = 4
dclass = Class.new(C)
- dclass.send!(:alias_method, :mm, :m)
+ dclass.send(:alias_method, :mm, :m)
dclass.new
}.call
assert_raise(SecurityError) { d.mm }
diff --git a/test/ruby/test_assignment.rb b/test/ruby/test_assignment.rb
index b355e444cf..df0ae0713c 100644
--- a/test/ruby/test_assignment.rb
+++ b/test/ruby/test_assignment.rb
@@ -652,7 +652,7 @@ class TestAssignmentGen < Test::Unit::TestCase
assign = assign.to_s
code1 = "#{assign}; [#{vars.join(",")}]"
assign.gsub!(/\bv\d+\b/, "o.a")
- code2 = "o=[];class << o; self end.send!(:define_method,:a=){|v|self << v};#{assign};o"
+ code2 = "o=[];class << o; self end.send(:define_method,:a=){|v|self << v};#{assign};o"
begin
vals1 = eval(code1)
rescue Exception
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb
index 22cc4456d3..281548b096 100644
--- a/test/ruby/test_eval.rb
+++ b/test/ruby/test_eval.rb
@@ -124,7 +124,7 @@ class TestEval < Test::Unit::TestCase
obj.class.class_variable_set :@@cvar, 13
# Use same value with env. See also test_instance_variable_cvar.
obj.class.const_set :Const, 15 unless obj.class.const_defined?(:Const)
- send! mid, obj
+ send mid, obj
end
end
@@ -364,7 +364,7 @@ class TestEval < Test::Unit::TestCase
assert_nothing_raised {
def temporally_method_for_test_eval_and_define_method(&block)
lambda {
- class << Object.new; self end.send!(:define_method, :zzz, &block)
+ class << Object.new; self end.send(:define_method, :zzz, &block)
}
end
v = eval("temporally_method_for_test_eval_and_define_method {}")
diff --git a/test/ruby/test_primitive.rb b/test/ruby/test_primitive.rb
index 68c53b0bd7..8ffbe549d6 100644
--- a/test/ruby/test_primitive.rb
+++ b/test/ruby/test_primitive.rb
@@ -50,7 +50,7 @@ class TestRubyPrimitive < Test::Unit::TestCase
assert_equal 3, A::B::C::Const
assert_equal 3, A::B::C.new.const
assert_equal 1, ::TestRubyPrimitive::A::Const
- A::B::C.send!(:remove_const, :Const)
+ A::B::C.send(:remove_const, :Const)
assert_equal 2, A::B::C.new.const
assert_raise(TypeError) {
C::CONST
diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb
index dc61ede9d7..2eba8a1cb0 100644
--- a/test/socket/test_socket.rb
+++ b/test/socket/test_socket.rb
@@ -19,7 +19,7 @@ class TestBasicSocket < Test::Unit::TestCase
n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)
assert_equal([0].pack("i"), n)
val = Object.new
- class << val; self end.send!(:define_method, :to_int) {
+ class << val; self end.send(:define_method, :to_int) {
s.close
Socket::SO_TYPE
}
@@ -34,7 +34,7 @@ class TestBasicSocket < Test::Unit::TestCase
linger = [0, 0].pack("ii")
val = Object.new
- class << val; self end.send!(:define_method, :to_str) {
+ class << val; self end.send(:define_method, :to_str) {
s.close
linger
}
@@ -47,7 +47,7 @@ class TestBasicSocket < Test::Unit::TestCase
end
val = Object.new
- class << val; self end.send!(:define_method, :to_int) {
+ class << val; self end.send(:define_method, :to_int) {
s.close
Socket::SO_LINGER
}
@@ -61,7 +61,7 @@ class TestBasicSocket < Test::Unit::TestCase
def test_listen
s = nil
log = Object.new
- class << log; self end.send!(:define_method, :to_int) {
+ class << log; self end.send(:define_method, :to_int) {
s.close
2
}
diff --git a/test/socket/test_udp.rb b/test/socket/test_udp.rb
index 654b506573..07fd17a2cb 100644
--- a/test/socket/test_udp.rb
+++ b/test/socket/test_udp.rb
@@ -9,7 +9,7 @@ class TestUDPSocket < Test::Unit::TestCase
def test_connect # [ruby-dev:25045]
s = UDPSocket.new
host = Object.new
- class << host; self end.send!(:define_method, :to_str) {
+ class << host; self end.send(:define_method, :to_str) {
s.close
"127.0.0.1"
}
@@ -21,7 +21,7 @@ class TestUDPSocket < Test::Unit::TestCase
def test_bind # [ruby-dev:25057]
s = UDPSocket.new
host = Object.new
- class << host; self end.send!(:define_method, :to_str) {
+ class << host; self end.send(:define_method, :to_str) {
s.close
"127.0.0.1"
}