ruby-changes:30734
From: kou <ko1@a...>
Date: Tue, 3 Sep 2013 22:57:24 +0900 (JST)
Subject: [ruby-changes:30734] kou:r42813 (trunk): * lib/rexml/parsers/treeparser.rb (REXML::Parsers::TreeParser#parse):
kou 2013-09-03 22:57:18 +0900 (Tue, 03 Sep 2013) New Revision: 42813 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42813 Log: * lib/rexml/parsers/treeparser.rb (REXML::Parsers::TreeParser#parse): Remove needless nested parse exception information. [Bug #8844] [ruby-dev:47672] Reported by Ippei Obayashi. Thanks!!! * test/rexml/parser/test_tree.rb: Add a test for the above case. Added files: trunk/test/rexml/parser/test_tree.rb Modified files: trunk/ChangeLog trunk/lib/rexml/parsers/treeparser.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 42812) +++ ChangeLog (revision 42813) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Sep 3 22:54:46 2013 Kouhei Sutou <kou@c...> + + * lib/rexml/parsers/treeparser.rb (REXML::Parsers::TreeParser#parse): + Remove needless nested parse exception information. + [Bug #8844] [ruby-dev:47672] + Reported by Ippei Obayashi. Thanks!!! + * test/rexml/parser/test_tree.rb: Add a test for the above case. + Tue Sep 3 22:03:49 2013 Nobuyoshi Nakada <nobu@r...> * string.c (rb_enc_str_new_cstr): new function to create a string from Index: lib/rexml/parsers/treeparser.rb =================================================================== --- lib/rexml/parsers/treeparser.rb (revision 42812) +++ lib/rexml/parsers/treeparser.rb (revision 42813) @@ -89,7 +89,7 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/treeparser.rb#L89 end rescue REXML::Validation::ValidationException raise - rescue REXML::UndefinedNamespaceException + rescue REXML::ParseException raise rescue raise ParseException.new( $!.message, @parser.source, @parser, $! ) Index: test/rexml/parser/test_tree.rb =================================================================== --- test/rexml/parser/test_tree.rb (revision 0) +++ test/rexml/parser/test_tree.rb (revision 42813) @@ -0,0 +1,27 @@ https://github.com/ruby/ruby/blob/trunk/test/rexml/parser/test_tree.rb#L1 +require "test/unit" +require "rexml/document" +require "rexml/parsers/treeparser" + +class TestTreeParser < Test::Unit::TestCase + class TestInvalid < self + def test_parse_exception + xml = "<root></not-root>" + exception = assert_raise(REXML::ParseException) do + parse(xml) + end + assert_equal(<<-MESSAGE, exception.to_s) +Missing end tag for 'root' (got "not-root") +Line: 1 +Position: 17 +Last 80 unconsumed characters: + MESSAGE + end + + private + def parse(xml) + document = REXML::Document.new + parser = REXML::Parsers::TreeParser.new(xml, document) + parser.parse + end + end +end Property changes on: test/rexml/parser/test_tree.rb ___________________________________________________________________ Added: svn:eol-style + LF -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/