[299615] XML auto-format erases data [297208] [formatting] Format Source doesn't format XML files correctly with preserve whitespace mode
diff --git a/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/TestPartitionFormatterXML.java b/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/TestPartitionFormatterXML.java index b382943..26a03dc 100644 --- a/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/TestPartitionFormatterXML.java +++ b/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/TestPartitionFormatterXML.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. + * Copyright (c) 2007, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -330,4 +330,9 @@ // Test that text content that is split into multiple document regions does not stop the formatter formatAndAssertEquals("testfiles/xml/xml-229135.xml", "testfiles/xml/xml-229135-fmt.xml"); } + + public void testFormatTextContentBeforeComment() throws UnsupportedEncodingException, IOException, CoreException { + // Bug 299615 + formatAndAssertEquals("testfiles/xml/format-text-content-before-comment.xml", "testfiles/xml/format-text-content-before-comment-fmt.xml"); + } }
diff --git a/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/format-text-content-before-comment-fmt.xml b/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/format-text-content-before-comment-fmt.xml new file mode 100644 index 0000000..74bd652 --- /dev/null +++ b/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/format-text-content-before-comment-fmt.xml
@@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<sometag> + 42<!-- comment --> +</sometag>
diff --git a/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/format-text-content-before-comment.xml b/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/format-text-content-before-comment.xml new file mode 100644 index 0000000..ea75230 --- /dev/null +++ b/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/format-text-content-before-comment.xml
@@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<sometag>42<!-- comment --></sometag>