From 683e1566922c603eb7606bdf959b1a7e87609fd8 Mon Sep 17 00:00:00 2001 From: NAITOH Jun Date: Sun, 23 Jun 2024 23:55:32 +0900 Subject: [PATCH] Add a test for `BaseParser#unnormalize` --- test/test_pullparser.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/test_pullparser.rb b/test/test_pullparser.rb index 53a985ba..b6a48c93 100644 --- a/test/test_pullparser.rb +++ b/test/test_pullparser.rb @@ -62,6 +62,26 @@ def test_entity_replacement end end + def test_character_references + source = 'AB' + 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 = "" REXML::Parsers::PullParser.new(source)