Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Renamed test_normalize_space2 for better clarity and updated tests to use Array of String for expected data. #110

Co-authored-by: Sutou Kouhei <[email protected]>
  • Loading branch information
flatland001 and kou authored Feb 8, 2024
1 parent a5508e6 commit c87b0e3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/functions/test_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,8 @@ 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
def test_normalize_space_strings
source = <<-XML
<a><b>breakfast boosts\t\t
concentration </b><c>
Expand All @@ -243,9 +242,13 @@ def test_normalize_space2
</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 )
normalized_texts = REXML::XPath.each(REXML::Document.new(source), "normalize-space(//text())").to_a
assert_equal([
"breakfast boosts concentration",
"Coffee beans aroma",
"Dessert after dinner",
],
normalized_texts)
end

def test_string_nil_without_context
Expand Down

0 comments on commit c87b0e3

Please sign in to comment.