mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* lib/rexml/formatters/pretty.rb (REXML::Formatters::Pretty#wrap):
REXML::Formatters::Pretty#wrap used a recursive method call to format text. This switches it to use an iterative approach. [ruby-core:33245] Patch by Jeremy Evans. Thanks!!! * test/rexml/test_core.rb: add a test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c6e4767068
commit
6fcd0b37b3
3 changed files with 33 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue