Project

General

Profile

Bug #4067 ยป rexml_fix.diff

Patch for REXML::Formatters::Pretty#wrap - jeremyevans0 (Jeremy Evans), 11/18/2010 07:46 AM

View differences:

lib/rexml/formatters/pretty.rb
end
def wrap(string, width)
# Recursively wrap string at width.
return string if string.length <= width
place = string.rindex(' ', width) # Position in string with last ' ' before cutoff
return string if place.nil?
return string[0,place] + "\n" + wrap(string[place+1..-1], width)
parts = []
last_place = 0
while string.length > width and place = string.rindex(' ', width)
parts << string[0...place]
string = string[place+1..-1]
end
parts << string
parts.join("\n")
end
end
test/rexml/test_core.rb
assert_not_equal( c, d )
end
def test_long_text
aaaa = 'aaaa ' * 1_000_000
a = "<doc>#{aaaa}</doc>"
f = REXML::Formatters::Pretty.new
xmldoc = REXML::Document.new( a )
assert_nothing_raised{f.write(xmldoc, b="")}
end
def test_ticket_58
doc = REXML::Document.new
    (1-1/1)