Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop adding extra new line after XML declaration with pretty format (#…
…164) If the XML file does not end with a newline, a space is added to the end of the first line. ```ruby Failure: test_indent(REXMLTests::TestDocument::WriteTest::ArgumentsTest) /Users/naitoh/ghq/github.com/naitoh/rexml/test/test_document.rb:270:in `test_indent' 267: output = "" 268: indent = 2 269: @document.write(output, indent) => 270: assert_equal(<<-EOX.chomp, output) 271: <?xml version='1.0' encoding='UTF-8'?> 272: <message> 273: Hello world! <"<?xml version='1.0' encoding='UTF-8'?>\n" + "<message>\n" + " Hello world!\n" + "</message>"> expected but was <"<?xml version='1.0' encoding='UTF-8'?> \n" + "<message>\n" + " Hello world!\n" + "</message>"> diff: ? <?xml version='1.0' encoding='UTF-8'?> <message> Hello world! </message> ``` This is happen because `REXML::Formatters::Pretty#write_document` has a logic that depends on the last text node. We should ignore all top-level text nodes with pretty format.
- Loading branch information