summaryrefslogtreecommitdiff
path: root/test/rexml/parser
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-11 09:41:29 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-11 09:41:29 +0000
commit7e0022bc8e89cd125f5fe97bc81a169d72d912e9 (patch)
treee0cfeab987e7ba99ecfcd7e05c23183f96b79305 /test/rexml/parser
parente0fff0d2b83a326363347b2eb508a4e0ae8a4683 (diff)
* lib/rexml/parsers/sax2parser.rb (REXML::Parsers::SAX2Parser#parse):
Fix wrong "%" position in parameter entity declaration event argument. * test/rexml/parser/test_sax2.rb: Add tests for the above case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml/parser')
-rw-r--r--test/rexml/parser/test_sax2.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/rexml/parser/test_sax2.rb b/test/rexml/parser/test_sax2.rb
index a4279fa..5ce9db7 100644
--- a/test/rexml/parser/test_sax2.rb
+++ b/test/rexml/parser/test_sax2.rb
@@ -103,6 +103,47 @@ class TestSAX2Parser < Test::Unit::TestCase
end
end
end
+
+ class TestParameterEntity < self
+ class TestValue < self
+ def test_double_quote
+ assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET))
+<!ENTITY % name "value">
+ INTERNAL_SUBSET
+ end
+
+ def test_single_quote
+ assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET))
+<!ENTITY % name 'value'>
+ INTERNAL_SUBSET
+ end
+ end
+
+ class TestExternlID < self
+ def test_system
+ declaration = [
+ "%",
+ "name",
+ "SYSTEM", "system-literal",
+ ]
+ assert_equal([declaration],
+ parse(<<-INTERNAL_SUBSET))
+<!ENTITY % name SYSTEM "system-literal">
+ INTERNAL_SUBSET
+ end
+
+ def test_public
+ 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