Skip to content

Commit

Permalink
Add a test for BaseParser#unnormalize
Browse files Browse the repository at this point in the history
  • Loading branch information
naitoh committed Jun 23, 2024
1 parent e6e07f2 commit 683e156
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/test_pullparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,26 @@ def test_entity_replacement
end
end

def test_character_references
source = '<a>&#65;</a><b>&#x42;</b>'
parser = REXML::Parsers::PullParser.new( source )
element_name = ''
while parser.has_next?
event = parser.pull
case event.event_type
when :start_element
element_name = event[0]
when :text
case element_name
when 'a'
assert_equal('A', event[1])
when 'b'
assert_equal('B', event[1])
end
end
end
end

def test_peek_unshift
source = "<a><b/></a>"
REXML::Parsers::PullParser.new(source)
Expand Down

0 comments on commit 683e156

Please sign in to comment.