# File tests/writertester.rb, line 128 def compare_to_rsrc_xml(io, sourceFooToBletch) writtenLines = io.read() # What we expect is slightly different than the original XML # because entities have been replaced and the output tags and # attribute values have been normalized. normalizedXml = @rsrc.xml.dup() normalizedXml.gsub!(/&foo;/, 'bletch') normalizedXml.gsub!('/>', '></inner:tag>') normalizedXml.gsub!("tabs\tto\tspaces", "tabs to spaces") # The writer's output won't have the same whitespace. normalizedXml.gsub!(/^\+\(!ENTITY|!ELEMENT|!ATTLIST|!NOTATION|\|!--)/, '<\1') # Get rid of a newline the writer does not output. normalizedXml.gsub!(/(<!DOCTYPE(.+?))[\n]]>/m, '\1]>') # Add a newline that is in the file input.xml but is not generated. writtenLines << "\n" assert_equal(normalizedXml, writtenLines) end