ruby-changes:24454
From: naruse <ko1@a...>
Date: Tue, 24 Jul 2012 06:38:44 +0900 (JST)
Subject: [ruby-changes:24454] naruse:r36505 (trunk): Suppress warnings.
naruse 2012-07-24 06:37:39 +0900 (Tue, 24 Jul 2012) New Revision: 36505 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36505 Log: Suppress warnings. Modified files: trunk/test/rexml/test_contrib.rb trunk/test/rexml/test_lightparser.rb trunk/test/rexml/test_pullparser.rb trunk/test/rexml/test_xpath.rb trunk/test/rexml/test_xpathtext.rb trunk/test/rss/rss-assertions.rb trunk/test/rss/rss-testcase.rb trunk/test/rss/test_1.0.rb trunk/test/rss/test_2.0.rb trunk/test/rss/test_atom.rb trunk/test/rss/test_maker_2.0.rb Index: test/rexml/test_lightparser.rb =================================================================== --- test/rexml/test_lightparser.rb (revision 36504) +++ test/rexml/test_lightparser.rb (revision 36505) @@ -7,6 +7,6 @@ def test_parsing f = File.new(fixture_path("documentation.xml")) parser = REXML::Parsers::LightParser.new( f ) - root = parser.parse + parser.parse end end Index: test/rexml/test_xpath.rb =================================================================== --- test/rexml/test_xpath.rb (revision 36504) +++ test/rexml/test_xpath.rb (revision 36505) @@ -219,7 +219,7 @@ for line in File.new(xpathtests) line.strip! begin - rt = doc.root + doc.root #puts "#"*80 #print "\nDoing #{line} " ; $stdout.flush doc.elements.each(line) do |el| @@ -332,7 +332,7 @@ </foo> EOF doc = Document.new source - result = XPath.each( doc, "//bar" ) { + XPath.each( doc, "//bar" ) { fail "'bar' should match nothing in this case" } @@ -523,7 +523,7 @@ # examples from http://www.w3.org/TR/xpath#function-substring doc = Document.new('<test string="12345" />') - d = Document.new("<a b='1'/>") + Document.new("<a b='1'/>") #puts XPath.first(d, 'node()[0 + 1]') #d = Document.new("<a b='1'/>") #puts XPath.first(d, 'a[0 mod 0]') @@ -589,7 +589,7 @@ def test_name assert_raise( UndefinedNamespaceException, "x should be undefined" ) { - d = REXML::Document.new("<a x='foo'><b/><x:b/></a>") + REXML::Document.new("<a x='foo'><b/><x:b/></a>") } d = REXML::Document.new("<a xmlns:x='foo'><b/><x:b/></a>") assert_equal 1, d.root.elements.to_a('*[name() = "b"]').size Index: test/rexml/test_pullparser.rb =================================================================== --- test/rexml/test_pullparser.rb (revision 36504) +++ test/rexml/test_pullparser.rb (revision 36505) @@ -33,7 +33,7 @@ source = "<a><b></a>" parser = REXML::Parsers::PullParser.new(source) assert_raise(ParseException, "Parsing should have failed") { - results = parser.pull while parser.has_next? + parser.pull while parser.has_next? } end @@ -63,7 +63,7 @@ def test_peek_unshift source = "<a><b/></a>" - pp = REXML::Parsers::PullParser.new(source) + REXML::Parsers::PullParser.new(source) # FINISH ME! end Index: test/rexml/test_contrib.rb =================================================================== --- test/rexml/test_contrib.rb (revision 36504) +++ test/rexml/test_contrib.rb (revision 36505) @@ -221,7 +221,7 @@ <type>Book</type> <year>2000</year> </entry>" - desired_result_tree = Document.new desired_result_string + Document.new desired_result_string xpath = "/biblio/entry[not(author)]" result = XPath.first(doc, xpath) assert_equal desired_result_string, result.to_s @@ -438,7 +438,7 @@ end def test_whitespace_after_xml_decl - d = Document.new <<EOL + Document.new <<EOL <?xml version='1.0'?> <blo> <wak> @@ -506,7 +506,7 @@ b << c a << b - REXML::Formatters::Pretty.new.write(a,s="") + REXML::Formatters::Pretty.new.write(a,"") end def test_pos @@ -523,7 +523,7 @@ testfile.puts testdata testfile.rewind assert_nothing_raised do - d = REXML::Document.new(testfile) + REXML::Document.new(testfile) end testfile.close(true) end Index: test/rexml/test_xpathtext.rb =================================================================== --- test/rexml/test_xpathtext.rb (revision 36504) +++ test/rexml/test_xpathtext.rb (revision 36505) @@ -14,7 +14,7 @@ def test_text_as_element node1 = REXML::Element.new('a', @doc) node2 = REXML::Element.new('b', node1) - textnode = REXML::Text.new('test', false, node2) + REXML::Text.new('test', false, node2) assert_equal(1, @doc.elements.size, "doc owns 1 element node1") assert_same(node1, @doc.elements[1], "doc owns 1 element node1") assert_equal(1, node1.elements.size, "node1 owns 1 element node2") Index: test/rss/test_maker_2.0.rb =================================================================== --- test/rss/test_maker_2.0.rb (revision 36504) +++ test/rss/test_maker_2.0.rb (revision 36505) @@ -445,7 +445,7 @@ def test_pubDate_without_description title = "TITLE" link = "http://hoge.com/" - description = "text hoge fuga" + # description = "text hoge fuga" author = "oprah@o..." pubDate = Time.now @@ -529,13 +529,13 @@ 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 @@ end def test_not_valid_category - content = "Grateful Dead" + # content = "Grateful Dead" rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) Index: test/rss/rss-testcase.rb =================================================================== --- test/rss/rss-testcase.rb (revision 36504) +++ test/rss/rss-testcase.rb (revision 36505) @@ -186,7 +186,7 @@ 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 Index: test/rss/test_2.0.rb =================================================================== --- test/rss/test_2.0.rb (revision 36504) +++ test/rss/test_2.0.rb (revision 36505) @@ -53,16 +53,22 @@ end def test_channel - title = "fugafuga" - link = "http://hoge.com" - description = "fugafugafugafuga" + h = { + 'title' => "fugafuga", + 'link' => "http://hoge.com", + 'description' => "fugafugafugafuga", - language = "en-us" - copyright = "Copyright 2002, Spartanburg Herald-Journal" - managingEditor = "geo@h... (George Matesky)" - webMaster = "betty@h... (Betty Guernsey)" - pubDate = Time.parse("Sat, 07 Sep 2002 00:00:01 GMT") - lastBuildDate = Time.parse("Sat, 07 Sep 2002 09:42:31 GMT") + 'language' => "en-us", + 'copyright' => "Copyright 2002, Spartanburg Herald-Journal", + 'managingEditor' => "geo@h... (George Matesky)", + 'webMaster' => "betty@h... (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,20 +78,14 @@ :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 elems = %w(title link description language copyright 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 @@ 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 @@ end def test_item - title = "fugafuga" - link = "http://hoge.com/" - description = "text hoge fuga" - author = "oprah@o..." + h = { + 'title' => "fugafuga", + 'link' => "http://hoge.com/", + 'description' => "text hoge fuga", + 'author' => "oprah@o...", + '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 @@ :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 @@ 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 @@ 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)) Index: test/rss/rss-assertions.rb =================================================================== --- test/rss/rss-assertions.rb (revision 36504) +++ test/rss/rss-assertions.rb (revision 36505) @@ -972,7 +972,7 @@ feed_readers) do |maker| yield maker targets = chain_reader(maker, maker_readers) - target = targets.new_child + targets.new_child end end Index: test/rss/test_1.0.rb =================================================================== --- test/rss/test_1.0.rb (revision 36504) +++ test/rss/test_1.0.rb (revision 36505) @@ -54,9 +54,6 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 Index: test/rss/test_atom.rb =================================================================== --- test/rss/test_atom.rb (revision 36504) +++ test/rss/test_atom.rb (revision 36505) @@ -453,11 +453,13 @@ 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 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/