diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-23 09:49:02 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-23 09:49:02 +0000 |
commit | 11077baae97e7a03ce9db488c3ab7d59083466d4 (patch) | |
tree | 7c43d8cf9eb336b45ed84608ff254beca7fdc9e4 /test | |
parent | b1f8c4eca042dd718d14c7150d8a9165e3c4b41e (diff) | |
download | ruby-11077baae97e7a03ce9db488c3ab7d59083466d4.tar.gz ruby-11077baae97e7a03ce9db488c3ab7d59083466d4.tar.xz ruby-11077baae97e7a03ce9db488c3ab7d59083466d4.zip |
* lib/rss/: use #__send__ instead of #send.
* test/rss/: ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/rss/rss-assertions.rb | 6 | ||||
-rw-r--r-- | test/rss/test_1.0.rb | 10 | ||||
-rw-r--r-- | test/rss/test_content.rb | 9 | ||||
-rw-r--r-- | test/rss/test_dublincore.rb | 48 | ||||
-rw-r--r-- | test/rss/test_image.rb | 40 | ||||
-rw-r--r-- | test/rss/test_syndication.rb | 14 | ||||
-rw-r--r-- | test/rss/test_trackback.rb | 22 |
7 files changed, 79 insertions, 70 deletions
diff --git a/test/rss/rss-assertions.rb b/test/rss/rss-assertions.rb index d8e597cd5..435f893e8 100644 --- a/test/rss/rss-assertions.rb +++ b/test/rss/rss-assertions.rb @@ -15,10 +15,10 @@ module RSS module Assertions def assert_parse(rss, assert_method, *args) - send("assert_#{assert_method}", *args) do + __send__("assert_#{assert_method}", *args) do ::RSS::Parser.parse(rss) end - send("assert_#{assert_method}", *args) do + __send__("assert_#{assert_method}", *args) do ::RSS::Parser.parse(rss, false).validate end end @@ -119,7 +119,7 @@ module RSS _wrap_assertion do n_attrs = normalized_attrs(attrs) ::RSS::XMLStyleSheet::ATTRIBUTES.each do |name| - assert_equal(n_attrs[name], xsl.send(name)) + assert_equal(n_attrs[name], xsl.__send__(name)) end end end diff --git a/test/rss/test_1.0.rb b/test/rss/test_1.0.rb index c37bd8461..5a01e9f5c 100644 --- a/test/rss/test_1.0.rb +++ b/test/rss/test_1.0.rb @@ -28,7 +28,7 @@ module RSS xmldecl = doc.xml_decl %w(version encoding).each do |x| - assert_equal(instance_eval(x), xmldecl.send(x)) + assert_equal(instance_eval(x), xmldecl.__send__(x)) end assert_equal(standalone, !xmldecl.standalone.nil?) @@ -69,7 +69,7 @@ module RSS channel = RDF::Channel.new(about) %w(title link description image items textinput).each do |x| - channel.send("#{x}=", instance_eval(x)) + channel.__send__("#{x}=", instance_eval(x)) end doc = REXML::Document.new(make_RDF(channel.to_s)) @@ -187,7 +187,7 @@ module RSS image = RDF::Image.new(about) %w(title url link).each do |x| - image.send("#{x}=", instance_eval(x)) + image.__send__("#{x}=", instance_eval(x)) end doc = REXML::Document.new(make_RDF(image.to_s)) @@ -212,7 +212,7 @@ module RSS item = RDF::Item.new(about) %w(title link description).each do |x| - item.send("#{x}=", instance_eval(x)) + item.__send__("#{x}=", instance_eval(x)) end doc = REXML::Document.new(make_RDF(item.to_s)) @@ -238,7 +238,7 @@ module RSS textinput = RDF::Textinput.new(about) %w(title link name description).each do |x| - textinput.send("#{x}=", instance_eval(x)) + textinput.__send__("#{x}=", instance_eval(x)) end doc = REXML::Document.new(make_RDF(textinput.to_s)) diff --git a/test/rss/test_content.rb b/test/rss/test_content.rb index ae1ff6230..b0ecbd4cf 100644 --- a/test/rss/test_content.rb +++ b/test/rss/test_content.rb @@ -61,21 +61,20 @@ EOR @elems.each do |name, value| @parents.each do |parent| meth = "#{RSS::CONTENT_PREFIX}_#{name}" - assert_equal(value, @rss.send(parent).funcall(meth)) - @rss.send(parent).funcall("#{meth}=", new_value[name].to_s) - assert_equal(new_value[name], @rss.send(parent).funcall(meth)) + assert_equal(value, @rss.__send__(parent).funcall(meth)) + @rss.__send__(parent).funcall("#{meth}=", new_value[name].to_s) + assert_equal(new_value[name], @rss.__send__(parent).funcall(meth)) end end end def test_to_s - @elems.each do |name, value| excepted = "<#{@prefix}:#{name}>#{CGI.escapeHTML(value)}</#{@prefix}:#{name}>" @parents.each do |parent| meth = "#{RSS::CONTENT_PREFIX}_#{name}_element" - assert_equal(excepted, @rss.send(parent).funcall(meth)) + assert_equal(excepted, @rss.__send__(parent).funcall(meth)) end end diff --git a/test/rss/test_dublincore.rb b/test/rss/test_dublincore.rb index dcb4896c4..36c7f14ec 100644 --- a/test/rss/test_dublincore.rb +++ b/test/rss/test_dublincore.rb @@ -87,7 +87,7 @@ EOR @elems.each do |name, value| @parents.each do |parent| - parsed_value = @rss.send(parent).send("dc_#{name}") + parsed_value = @rss.__send__(parent).__send__("dc_#{name}") if parsed_value.kind_of?(String) parsed_value = CGI.escapeHTML(parsed_value) end @@ -97,16 +97,17 @@ EOR class << t alias_method(:to_s, :iso8601) end - @rss.send(parent).send("dc_#{name}=", t.iso8601) - assert_equal(t, @rss.send(parent).send("dc_#{name}")) - assert_equal(t, @rss.send(parent).date) + @rss.__send__(parent).__send__("dc_#{name}=", t.iso8601) + assert_equal(t, @rss.__send__(parent).__send__("dc_#{name}")) + assert_equal(t, @rss.__send__(parent).date) - @rss.send(parent).date = value - assert_equal(value, @rss.send(parent).date) - assert_equal(value, @rss.send(parent).send("dc_#{name}")) + @rss.__send__(parent).date = value + assert_equal(value, @rss.__send__(parent).date) + assert_equal(value, @rss.__send__(parent).__send__("dc_#{name}")) else - @rss.send(parent).send("dc_#{name}=", new_value) - assert_equal(new_value, @rss.send(parent).send("dc_#{name}")) + @rss.__send__(parent).__send__("dc_#{name}=", new_value) + assert_equal(new_value, + @rss.__send__(parent).__send__("dc_#{name}")) end end end @@ -117,7 +118,7 @@ EOR @elems.each do |name, value| @parents.each do |parent| - parsed_value = @rss.send(parent).send("dc_#{name}") + parsed_value = @rss.__send__(parent).__send__("dc_#{name}") if parsed_value.kind_of?(String) parsed_value = CGI.escapeHTML(parsed_value) end @@ -131,16 +132,21 @@ EOR class << t alias_method(:to_s, :iso8601) end - elems = @rss.send(parent).send(plural_reader) + elems = @rss.__send__(parent).__send__(plural_reader) elems << klass.new(t.iso8601) - values = @rss.send(parent).send(plural_reader).collect{|x| x.value} - assert_equal([@rss.send(parent).send("dc_#{name}"), t], + new_elems = @rss.__send__(parent).__send__(plural_reader) + values = new_elems.collect{|x| x.value} + assert_equal([@rss.__send__(parent).__send__("dc_#{name}"), t], values) else - elems = @rss.send(parent).send(plural_reader) + elems = @rss.__send__(parent).__send__(plural_reader) elems << klass.new(new_value) - values = @rss.send(parent).send(plural_reader).collect{|x| x.value} - assert_equal([@rss.send(parent).send("dc_#{name}"), new_value], + new_elems = @rss.__send__(parent).__send__(plural_reader) + values = new_elems.collect{|x| x.value} + assert_equal([ + @rss.__send__(parent).__send__("dc_#{name}"), + new_value + ], values) end end @@ -151,17 +157,19 @@ EOR @elems.each do |name, value| excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>" @parents.each do |parent| - assert_equal(excepted, @rss.send(parent).funcall("dc_#{name}_elements")) + assert_equal(excepted, + @rss.__send__(parent).funcall("dc_#{name}_elements")) end excepted = Array.new(2, excepted).join("\n") @parents.each do |parent| reader = "dc_#{name}" + (name == :rights ? "es" : "s") - elems = @rss.send(parent).send(reader) + elems = @rss.__send__(parent).__send__(reader) klass_name = "DublinCore#{Utils.to_class_name(name.to_s)}" klass = DublinCoreModel.const_get(klass_name) - elems << klass.new(@rss.send(parent).send("dc_#{name}")) - assert_equal(excepted, @rss.send(parent).funcall("dc_#{name}_elements")) + elems << klass.new(@rss.__send__(parent).__send__("dc_#{name}")) + assert_equal(excepted, + @rss.__send__(parent).funcall("dc_#{name}_elements")) end end diff --git a/test/rss/test_image.rb b/test/rss/test_image.rb index 8e62085b4..e26820500 100644 --- a/test/rss/test_image.rb +++ b/test/rss/test_image.rb @@ -86,21 +86,21 @@ EOR %w(size image:size large), %w(image_size image:size medium), ].each do |name, full_name, new_value| - assert_equal(@favicon_attrs[full_name], favicon.send(name)) - favicon.send("#{name}=", new_value) - assert_equal(new_value, favicon.send(name)) - favicon.send("#{name}=", @favicon_attrs[full_name]) - assert_equal(@favicon_attrs[full_name], favicon.send(name)) + assert_equal(@favicon_attrs[full_name], favicon.__send__(name)) + favicon.__send__("#{name}=", new_value) + assert_equal(new_value, favicon.__send__(name)) + favicon.__send__("#{name}=", @favicon_attrs[full_name]) + assert_equal(@favicon_attrs[full_name], favicon.__send__(name)) end [ %w(dc_title dc:title sample-favicon), ].each do |name, full_name, new_value| - assert_equal(@favicon_contents[full_name], favicon.send(name)) - favicon.send("#{name}=", new_value) - assert_equal(new_value, favicon.send(name)) - favicon.send("#{name}=", @favicon_contents[full_name]) - assert_equal(@favicon_contents[full_name], favicon.send(name)) + assert_equal(@favicon_contents[full_name], favicon.__send__(name)) + favicon.__send__("#{name}=", new_value) + assert_equal(new_value, favicon.__send__(name)) + favicon.__send__("#{name}=", @favicon_contents[full_name]) + assert_equal(@favicon_contents[full_name], favicon.__send__(name)) end end @@ -112,11 +112,11 @@ EOR %w(about rdf:about http://example.com/image.png), %w(resource rdf:resource http://example.com/), ].each do |name, full_name, new_value| - assert_equal(attrs[full_name], image_item.send(name)) - image_item.send("#{name}=", new_value) - assert_equal(new_value, image_item.send(name)) - image_item.send("#{name}=", attrs[full_name]) - assert_equal(attrs[full_name], image_item.send(name)) + assert_equal(attrs[full_name], image_item.__send__(name)) + image_item.__send__("#{name}=", new_value) + assert_equal(new_value, image_item.__send__(name)) + image_item.__send__("#{name}=", attrs[full_name]) + assert_equal(attrs[full_name], image_item.__send__(name)) end [ @@ -126,11 +126,11 @@ EOR ["image_height", "image:height", 88], ["dc_title", "dc:title", "sample-image"], ].each do |name, full_name, new_value| - assert_equal(contents[full_name], image_item.send(name)) - image_item.send("#{name}=", new_value) - assert_equal(new_value, image_item.send(name)) - image_item.send("#{name}=", contents[full_name]) - assert_equal(contents[full_name], image_item.send(name)) + assert_equal(contents[full_name], image_item.__send__(name)) + image_item.__send__("#{name}=", new_value) + assert_equal(new_value, image_item.__send__(name)) + image_item.__send__("#{name}=", contents[full_name]) + assert_equal(contents[full_name], image_item.__send__(name)) end end end diff --git a/test/rss/test_syndication.rb b/test/rss/test_syndication.rb index efbf24e08..0a3a21fa9 100644 --- a/test/rss/test_syndication.rb +++ b/test/rss/test_syndication.rb @@ -74,16 +74,17 @@ EOR @elems.each do |name, value| @parents.each do |parent| - assert_equal(value, @rss.send(parent).funcall("sy_#{name}")) - @rss.send(parent).funcall("sy_#{name}=", new_value[name].to_s) - assert_equal(new_value[name], @rss.send(parent).funcall("sy_#{name}")) + assert_equal(value, @rss.__send__(parent).funcall("sy_#{name}")) + @rss.__send__(parent).funcall("sy_#{name}=", new_value[name].to_s) + assert_equal(new_value[name], + @rss.__send__(parent).funcall("sy_#{name}")) end end %w(hourly daily weekly monthly yearly).each do |x| @parents.each do |parent| assert_nothing_raised do - @rss.send(parent).sy_updatePeriod = x + @rss.__send__(parent).sy_updatePeriod = x end end end @@ -91,7 +92,7 @@ EOR %w(-2 0.3 -0.4).each do |x| @parents.each do |parent| assert_not_available_value("updateBase", x) do - @rss.send(parent).sy_updateBase = x + @rss.__send__(parent).sy_updateBase = x end end end @@ -103,7 +104,8 @@ EOR @elems.each do |name, value| excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>" @parents.each do |parent| - assert_equal(excepted, @rss.send(parent).funcall("sy_#{name}_element")) + assert_equal(excepted, + @rss.__send__(parent).funcall("sy_#{name}_element")) end end diff --git a/test/rss/test_trackback.rb b/test/rss/test_trackback.rb index a00ddc0ec..5209a8c06 100644 --- a/test/rss/test_trackback.rb +++ b/test/rss/test_trackback.rb @@ -88,20 +88,20 @@ EOR @elems.each do |name, value| @parents.each do |parent| accessor = "#{RSS::TRACKBACK_PREFIX}_#{name}" - target = @rss.send(parent) - target20 = @rss20.channel.send(parent, -1) - assert_equal(value, target.send(accessor)) - assert_equal(value, target20.send(accessor)) + target = @rss.__send__(parent) + target20 = @rss20.channel.__send__(parent, -1) + assert_equal(value, target.__send__(accessor)) + assert_equal(value, target20.__send__(accessor)) if name == :about # abount is zero or more - target.send("#{accessor}=", 0, new_value[name].to_s) - target20.send("#{accessor}=", 0, new_value[name].to_s) + target.__send__("#{accessor}=", 0, new_value[name].to_s) + target20.__send__("#{accessor}=", 0, new_value[name].to_s) else - target.send("#{accessor}=", new_value[name].to_s) - target20.send("#{accessor}=", new_value[name].to_s) + target.__send__("#{accessor}=", new_value[name].to_s) + target20.__send__("#{accessor}=", new_value[name].to_s) end - assert_equal(new_value[name], target.send(accessor)) - assert_equal(new_value[name], target20.send(accessor)) + assert_equal(new_value[name], target.__send__(accessor)) + assert_equal(new_value[name], target20.__send__(accessor)) end end @@ -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).funcall(meth)) + assert_equal(excepted, @rss.__send__(parent).funcall(meth)) end end |