diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-11 09:01:41 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-11 09:01:41 +0000 |
commit | ce89dedde34e7b0304a96423a6a0c6b4284043cc (patch) | |
tree | a1c31036cf3981211e264303122aa47b5d4ad7aa /test/rexml | |
parent | 7e8b43687c1b7ec2baa600526df71c79f04fa911 (diff) | |
download | ruby-ce89dedde34e7b0304a96423a6a0c6b4284043cc.tar.gz |
* NEWS (REXML::Parsers::SAX2Parser): Add about this change.
* lib/rexml/parsers/sax2parser.rb (REXML::Parsers::SAX2Parser#parse):
Fix wrong number of arguments. Document says "an array of the
entity declaration" but it passes two or more arguments.
This is a bug but it break backward compatibility.
Reported by Ippei Obayashi. [Bug #8731] [ruby-dev:47582]
* lib/rexml/sax2listener.rb (REXML::SAX2Listener#entitydecl): ditto.
The listener template accepted two arguments.
* test/rexml/parser/test_sax2.rb: Add tests for external ID case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml')
-rw-r--r-- | test/rexml/parser/test_sax2.rb | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/test/rexml/parser/test_sax2.rb b/test/rexml/parser/test_sax2.rb index d808899dd2..f1e64121af 100644 --- a/test/rexml/parser/test_sax2.rb +++ b/test/rexml/parser/test_sax2.rb @@ -22,9 +22,9 @@ class TestSAX2Parser < Test::Unit::TestCase @entity_declarations = [] end - def entitydecl(*args) + def entitydecl(declaration) super - @entity_declarations << args + @entity_declarations << declaration end end @@ -51,6 +51,33 @@ class TestSAX2Parser < Test::Unit::TestCase INTERNAL_SUBSET end end + + class TestExternlID < self + class TestSystem < self + def test_without_ndata + declaration = [ + "name", + "SYSTEM", "system-literal", + ] + assert_equal([declaration], + parse(<<-INTERNAL_SUBSET)) +<!ENTITY name SYSTEM "system-literal"> + INTERNAL_SUBSET + end + end + + class TestPublic < self + def test_without_ndata + declaration = [ + "name", + "PUBLIC", "public-literal", "system-literal", + ] + assert_equal([declaration], parse(<<-INTERNAL_SUBSET)) +<!ENTITY name PUBLIC "public-literal" "system-literal"> + INTERNAL_SUBSET + end + end + end end end end |