Skip to content

Commit 68939ea

Browse files
committed
Add a test case to unnormalize the predefined entities of "text" in the stream parser.
See: ruby#168
1 parent cb15858 commit 68939ea

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_stream.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@ def entity(content)
8787

8888
assert_equal(["ISOLat2"], listener.entities)
8989
end
90+
91+
def test_characters_predefined_entities
92+
source = '<root><a>&lt;P&gt; &lt;I&gt; &lt;B&gt; Text &lt;/B&gt; &lt;/I&gt;</a></root>'
93+
94+
listener = MyListener.new
95+
class << listener
96+
attr_accessor :text_value
97+
def text(text)
98+
@text_value << text
99+
end
100+
end
101+
listener.text_value = ""
102+
REXML::Document.parse_stream(source, listener)
103+
assert_equal("<P> <I> <B> Text </B> </I>", listener.text_value)
104+
end
90105
end
91106

92107
class EntityExpansionLimitTest < Test::Unit::TestCase

0 commit comments

Comments
 (0)