ruby-changes:18092
From: kou <ko1@a...>
Date: Tue, 7 Dec 2010 21:17:52 +0900 (JST)
Subject: [ruby-changes:18092] Ruby:r30113 (trunk): * lib/rexml/doctype.rb, test/rexml/test_doctype.rb: suppress warnings.
kou 2010-12-07 21:10:23 +0900 (Tue, 07 Dec 2010) New Revision: 30113 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30113 Log: * lib/rexml/doctype.rb, test/rexml/test_doctype.rb: suppress warnings. [ruby-core:33305] Reported by Aaron Patterson. Thanks!!! Modified files: trunk/ChangeLog trunk/lib/rexml/doctype.rb trunk/test/rexml/test_doctype.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 30112) +++ ChangeLog (revision 30113) @@ -1,3 +1,9 @@ +Tue Dec 7 21:06:38 2010 Kouhei Sutou <kou@c...> + + * lib/rexml/doctype.rb, test/rexml/test_doctype.rb: suppress warnings. + [ruby-core:33305] + Reported by Aaron Patterson. Thanks!!! + Tue Dec 7 18:56:52 2010 NARUSE, Yui <naruse@r...> * ext/nkf/lib/kconv.rb (String#kconv): fix typo and update rdoc. Index: lib/rexml/doctype.rb =================================================================== --- lib/rexml/doctype.rb (revision 30112) +++ lib/rexml/doctype.rb (revision 30113) @@ -248,11 +248,11 @@ end def to_s - "<!NOTATION #@name #@middle#{ - @public ? ' ' + public.inspect : '' - }#{ - @system ? ' ' +@s... : '' - }>" + notation = "<!NOTATION #{@name} #{@middle}" + notation << " #{@public.inspect}" if @public + notation << " #{@system.inspect}" if @system + notation << ">" + notation end def write( output, indent=-1 ) Index: test/rexml/test_doctype.rb =================================================================== --- test/rexml/test_doctype.rb (revision 30112) +++ test/rexml/test_doctype.rb (revision 30113) @@ -65,3 +65,43 @@ end end + +class TestNotationDeclPublic < Test::Unit::TestCase + def setup + @name = "vrml" + @id = "VRML 1.0" + @uri = "http://www.web3d.org/" + end + + def test_to_s + assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\">", + decl(@id, nil).to_s) + end + + def test_to_s_with_uri + assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\" \"#{@uri}\">", + decl(@id, @uri).to_s) + end + + private + def decl(id, uri) + REXML::NotationDecl.new(@name, "PUBLIC", id, uri) + end +end + +class TestNotationDeclSystem < Test::Unit::TestCase + def setup + @name = "gif" + @id = "gif viewer" + end + + def test_to_s + assert_equal("<!NOTATION #{@name} SYSTEM \"#{@id}\">", + decl(@id).to_s) + end + + private + def decl(id) + REXML::NotationDecl.new(@name, "SYSTEM", id, nil) + end +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/