aboutsummaryrefslogtreecommitdiffstats
path: root/test/rexml
diff options
context:
space:
mode:
Diffstat (limited to 'test/rexml')
-rw-r--r--test/rexml/test_core.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/rexml/test_core.rb b/test/rexml/test_core.rb
index 5fae4f54e3..d9280f6aed 100644
--- a/test/rexml/test_core.rb
+++ b/test/rexml/test_core.rb
@@ -1151,6 +1151,22 @@ EOL
assert_not_equal( c, d )
end
+ def test_pretty_format_long_text_finite
+ n = 1_000_000
+ long_text = 'aaaa ' * n
+ xml = "<doc>#{long_text}</doc>"
+ formatter = REXML::Formatters::Pretty.new
+ document = REXML::Document.new(xml)
+ output = ""
+ assert_nothing_raised do
+ formatter.write(document, output)
+ end
+ assert_equal("<doc>\n" +
+ ((" " + (" aaaa" * 15) + "\n") * (n / 15)) +
+ " " + ("aaaa " * (n % 15)) + "\n" +
+ "</doc>",
+ output)
+ end
def test_ticket_58
doc = REXML::Document.new