summaryrefslogtreecommitdiff
path: root/test/rss
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-23 21:37:39 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-23 21:37:39 +0000
commitf6327e732fbc8c68dae163401d283924769dee8d (patch)
tree47f2922c8db27b572148164f8de904fa569bd7de /test/rss
parentd1c42e4f341e063d3849a3a9e3622b7261735559 (diff)
Suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rss')
-rw-r--r--test/rss/rss-assertions.rb2
-rw-r--r--test/rss/rss-testcase.rb2
-rw-r--r--test/rss/test_1.0.rb54
-rw-r--r--test/rss/test_2.0.rb54
-rw-r--r--test/rss/test_atom.rb24
-rw-r--r--test/rss/test_maker_2.0.rb8
6 files changed, 80 insertions, 64 deletions
diff --git a/test/rss/rss-assertions.rb b/test/rss/rss-assertions.rb
index 86f9dd8..090980a 100644
--- a/test/rss/rss-assertions.rb
+++ b/test/rss/rss-assertions.rb
@@ -972,7 +972,7 @@ EOA
feed_readers) do |maker|
yield maker
targets = chain_reader(maker, maker_readers)
- target = targets.new_child
+ targets.new_child
end
end
diff --git a/test/rss/rss-testcase.rb b/test/rss/rss-testcase.rb
index 6a7093a..4943fc9 100644
--- a/test/rss/rss-testcase.rb
+++ b/test/rss/rss-testcase.rb
@@ -186,7 +186,7 @@ EORSS
elems = ["<link>#{res}</link>"]
elems << "<title>title of #{res}</title>"
elems = elems.join("\n")
- item = "<item>\n#{elems}\n</item>"
+ "<item>\n#{elems}\n</item>"
end.join("\n")
end
diff --git a/test/rss/test_1.0.rb b/test/rss/test_1.0.rb
index 4b496ad..cb9f715 100644
--- a/test/rss/test_1.0.rb
+++ b/test/rss/test_1.0.rb
@@ -54,9 +54,6 @@ module RSS
def test_channel
about = "http://hoge.com"
- title = "fugafuga"
- link = "http://hoge.com"
- description = "fugafugafugafuga"
resource = "http://hoge.com/hoge.png"
item_title = "item title"
@@ -72,9 +69,18 @@ module RSS
rss_item.link = item_link
rss_item.about = item_link
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com",
+ 'description' => "fugafugafugafuga",
+ 'image' => image,
+ 'items' => items,
+ 'textinput' => textinput,
+ }
+
channel = RDF::Channel.new(about)
%w(title link description image items textinput).each do |x|
- channel.__send__("#{x}=", instance_eval(x))
+ channel.__send__("#{x}=", h[x])
end
doc = REXML::Document.new(make_RDF(<<-EOR))
@@ -96,7 +102,7 @@ EOR
assert_equal(@rdf_uri, res.namespace)
value = res.value
else
- excepted = instance_eval(x)
+ excepted = h[x]
value = elem.text
end
assert_equal(excepted, value)
@@ -199,13 +205,15 @@ EOR
def test_image
about = "http://hoge.com"
- title = "fugafuga"
- url = "http://hoge.com/hoge"
- link = "http://hoge.com/fuga"
+ h = {
+ 'title' => "fugafuga",
+ 'url' => "http://hoge.com/hoge",
+ 'link' => "http://hoge.com/fuga",
+ }
image = RDF::Image.new(about)
%w(title url link).each do |x|
- image.__send__("#{x}=", instance_eval(x))
+ image.__send__("#{x}=", h[x])
end
doc = REXML::Document.new(make_RDF(image.to_s))
@@ -216,19 +224,21 @@ EOR
elem = i.elements[x]
assert_equal(x, elem.name)
assert_equal(@uri, elem.namespace)
- assert_equal(instance_eval(x), elem.text)
+ assert_equal(h[x], elem.text)
end
end
def test_item
about = "http://hoge.com"
- title = "fugafuga"
- link = "http://hoge.com/fuga"
- description = "hogehogehoge"
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com/fuga",
+ 'description' => "hogehogehoge",
+ }
item = RDF::Item.new(about)
%w(title link description).each do |x|
- item.__send__("#{x}=", instance_eval(x))
+ item.__send__("#{x}=", h[x])
end
doc = REXML::Document.new(make_RDF(item.to_s))
@@ -239,20 +249,22 @@ EOR
elem = i.elements[x]
assert_equal(x, elem.name)
assert_equal(@uri, elem.namespace)
- assert_equal(instance_eval(x), elem.text)
+ assert_equal(h[x], elem.text)
end
end
def test_textinput
about = "http://hoge.com"
- title = "fugafuga"
- link = "http://hoge.com/fuga"
- name = "foo"
- description = "hogehogehoge"
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com/fuga",
+ 'name' => "foo",
+ 'description' => "hogehogehoge",
+ }
textinput = RDF::Textinput.new(about)
%w(title link name description).each do |x|
- textinput.__send__("#{x}=", instance_eval(x))
+ textinput.__send__("#{x}=", h[x])
end
doc = REXML::Document.new(make_RDF(textinput.to_s))
@@ -263,7 +275,7 @@ EOR
elem = t.elements[x]
assert_equal(x, elem.name)
assert_equal(@uri, elem.namespace)
- assert_equal(instance_eval(x), elem.text)
+ assert_equal(h[x], elem.text)
end
end
diff --git a/test/rss/test_2.0.rb b/test/rss/test_2.0.rb
index ed83ca6..5695110 100644
--- a/test/rss/test_2.0.rb
+++ b/test/rss/test_2.0.rb
@@ -53,16 +53,22 @@ module RSS
end
def test_channel
- title = "fugafuga"
- link = "http://hoge.com"
- description = "fugafugafugafuga"
-
- language = "en-us"
- copyright = "Copyright 2002, Spartanburg Herald-Journal"
- managingEditor = "geo@herald.com (George Matesky)"
- webMaster = "betty@herald.com (Betty Guernsey)"
- pubDate = Time.parse("Sat, 07 Sep 2002 00:00:01 GMT")
- lastBuildDate = Time.parse("Sat, 07 Sep 2002 09:42:31 GMT")
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com",
+ 'description' => "fugafugafugafuga",
+
+ 'language' => "en-us",
+ 'copyright' => "Copyright 2002, Spartanburg Herald-Journal",
+ 'managingEditor' => "geo@herald.com (George Matesky)",
+ 'webMaster' => "betty@herald.com (Betty Guernsey)",
+ 'pubDate' => Time.parse("Sat, 07 Sep 2002 00:00:01 GMT"),
+ 'lastBuildDate' => Time.parse("Sat, 07 Sep 2002 09:42:31 GMT"),
+ 'generator' => "MightyInHouse Content System v2.3",
+ 'docs' => "http://blogs.law.harvard.edu/tech/rss",
+ 'ttl' => "60",
+ 'rating' => '(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" for "http://www.rsac.org" on "1996.04.16T08:15-0500" r (n 0 s 0 v 0 l 0))',
+ }
categories = [
{
:content => "Newspapers",
@@ -72,12 +78,6 @@ module RSS
:content => "1765",
}
]
- generator = "MightyInHouse Content System v2.3"
- docs = "http://blogs.law.harvard.edu/tech/rss"
-
- ttl = "60"
-
- rating = '(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" for "http://www.rsac.org" on "1996.04.16T08:15-0500" r (n 0 s 0 v 0 l 0))'
channel = Rss::Channel.new
@@ -85,7 +85,7 @@ module RSS
managingEditor webMaster pubDate lastBuildDate
generator docs ttl rating)
elems.each do |x|
- value = instance_eval(x)
+ value = h[x]
value = value.rfc822 if %w(pubDate lastBuildDate).include?(x)
channel.__send__("#{x}=", value)
end
@@ -101,7 +101,7 @@ module RSS
elem = c.elements[x]
assert_equal(x, elem.name)
assert_equal("", elem.namespace)
- expected = instance_eval(x)
+ expected = h[x]
case x
when "pubDate", "lastBuildDate"
assert_equal(expected, Time.parse(elem.text))
@@ -236,10 +236,14 @@ module RSS
end
def test_item
- title = "fugafuga"
- link = "http://hoge.com/"
- description = "text hoge fuga"
- author = "oprah@oxygen.net"
+ h = {
+ 'title' => "fugafuga",
+ 'link' => "http://hoge.com/",
+ 'description' => "text hoge fuga",
+ 'author' => "oprah@oxygen.net",
+ 'comments' => "http://www.myblog.org/cgi-local/mt/mt-comments.cgi?entry_id=290",
+ 'pubDate' => Time.parse("Sat, 07 Sep 2002 00:00:01 GMT"),
+ }
categories = [
{
:content => "Newspapers",
@@ -249,8 +253,6 @@ module RSS
:content => "1765",
}
]
- comments = "http://www.myblog.org/cgi-local/mt/mt-comments.cgi?entry_id=290"
- pubDate = Time.parse("Sat, 07 Sep 2002 00:00:01 GMT")
channel = Rss::Channel.new
channel.title = "title"
@@ -262,7 +264,7 @@ module RSS
elems = %w(title link description author comments pubDate)
elems.each do |x|
- value = instance_eval(x)
+ value = h[x]
value = value.rfc822 if x == "pubDate"
item.__send__("#{x}=", value)
end
@@ -279,7 +281,7 @@ module RSS
elem = item_elem.elements[x]
assert_equal(x, elem.name)
assert_equal("", elem.namespace)
- expected = instance_eval(x)
+ expected = h[x]
case x
when "pubDate"
assert_equal(expected, Time.parse(elem.text))
diff --git a/test/rss/test_atom.rb b/test/rss/test_atom.rb
index 80da69b..e0ae108 100644
--- a/test/rss/test_atom.rb
+++ b/test/rss/test_atom.rb
@@ -453,11 +453,13 @@ module RSS
def assert_atom_link_to_s(target_class)
_wrap_assertion do
href = "http://example.com/atom.xml"
- rel = "self"
- type = "application/atom+xml"
- hreflang = "ja"
- title = "Atom Feed"
- length = "801"
+ optvs = {
+ 'rel' => "self",
+ 'type' => "application/atom+xml",
+ 'hreflang' => "ja",
+ 'title' => "Atom Feed",
+ 'length' => "801",
+ }
link = target_class.new
assert_equal("", link.to_s)
@@ -472,24 +474,24 @@ module RSS
rest = optional_arguments.reject {|x| x == name}
link = target_class.new
- link.__send__("#{name}=", eval(name))
+ link.__send__("#{name}=", optvs[name])
assert_equal("", link.to_s)
rest.each do |n|
- link.__send__("#{n}=", eval(n))
+ link.__send__("#{n}=", optvs[n])
assert_equal("", link.to_s)
end
link = target_class.new
link.href = href
- link.__send__("#{name}=", eval(name))
- attrs = [["href", href], [name, eval(name)]]
+ link.__send__("#{name}=", optvs[name])
+ attrs = [["href", href], [name, optvs[name]]]
xml = REXML::Document.new(link.to_s).root
assert_rexml_element([], attrs, nil, xml)
rest.each do |n|
- link.__send__("#{n}=", eval(n))
- attrs << [n, eval(n)]
+ link.__send__("#{n}=", optvs[n])
+ attrs << [n, optvs[n]]
xml = REXML::Document.new(link.to_s).root
assert_rexml_element([], attrs, nil, xml)
end
diff --git a/test/rss/test_maker_2.0.rb b/test/rss/test_maker_2.0.rb
index 705270d..530c3cc 100644
--- a/test/rss/test_maker_2.0.rb
+++ b/test/rss/test_maker_2.0.rb
@@ -445,7 +445,7 @@ module RSS
def test_pubDate_without_description
title = "TITLE"
link = "http://hoge.com/"
- description = "text hoge fuga"
+ # description = "text hoge fuga"
author = "oprah@oxygen.net"
pubDate = Time.now
@@ -529,13 +529,13 @@ module RSS
end
def test_not_valid_guid
- content = "http://inessential.com/2002/09/01.php#a2"
+ # content = "http://inessential.com/2002/09/01.php#a2"
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
- guid = maker.items.last.guid
+ # guid = maker.items.last.guid
# guid.content = content
end
assert_nil(rss.channel.items.last.guid)
@@ -662,7 +662,7 @@ module RSS
end
def test_not_valid_category
- content = "Grateful Dead"
+ # content = "Grateful Dead"
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)