Skip to content

Commit

Permalink
introduced test_normalize_space2() in test/functions/test_base.rb #110
Browse files Browse the repository at this point in the history
to validate `REXML::Functions::normalize_space()` functionality
  • Loading branch information
flatland001 committed Feb 7, 2024
1 parent 14af5b8 commit 85f2d4c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/functions/test_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,25 @@ def test_normalize_space
assert_equal( [REXML::Comment.new("COMMENT A")], m )
end

def test_normalize_space2
source1 = "<a><b>breakfast boosts concentration</b><c>Coffee beans aroma</c><d>Dessert after dinner</d></a>"
source2 = <<-XML
<a><b>breakfast boosts\t\t
concentration </b><c>
Coffee beans
aroma
</c><d> Dessert
\t\t after dinner</d></a>
XML
ret1 = REXML::XPath.each(REXML::Document.new(source1), "//text()").to_a
ret2 = REXML::XPath.each(REXML::Document.new(source2), "normalize-space(//text())").to_a
assert_equal( ret1, ret2 )
end

def test_string_nil_without_context
doc = REXML::Document.new(<<-XML)
<?xml version="1.0" encoding="UTF-8"?>
Expand Down

0 comments on commit 85f2d4c

Please sign in to comment.