summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSalvador Zalapa2013-01-28 11:37:22 (EST)
committer Nick Sandonato2013-01-29 14:39:56 (EST)
commite801e715d09a21f75d88c0d0467950972401b8d1 (patch)
treeacd84188dd24d094c3e168b4e4865bdd0b079e20
parent6845de30a516829a8a04cf4761d08d7ae392502d (diff)
downloadwebtools.sourceediting.tests-e801e715d09a21f75d88c0d0467950972401b8d1.zip
webtools.sourceediting.tests-e801e715d09a21f75d88c0d0467950972401b8d1.tar.gz
webtools.sourceediting.tests-e801e715d09a21f75d88c0d0467950972401b8d1.tar.bz2
[367579] [formatting] Formatting successive comments inserts spacesv201301291945201301291945
-rw-r--r--tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/format/TestFormatProcessorCSS.java26
-rw-r--r--tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/format/testfiles/bug367579-MultiSpaceAdittion.css3
2 files changed, 20 insertions, 9 deletions
diff --git a/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/format/TestFormatProcessorCSS.java b/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/format/TestFormatProcessorCSS.java
index fd1bdbd..546121e 100644
--- a/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/format/TestFormatProcessorCSS.java
+++ b/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/format/TestFormatProcessorCSS.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 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
@@ -100,17 +100,18 @@ public class TestFormatProcessorCSS extends TestCase {
afterModel = getModelForEdit(afterPath);
assertNotNull("could not retrieve structured model for : " + afterPath, afterModel);
- formatProcessor.formatModel(beforeModel);
-
- ByteArrayOutputStream formattedBytes = new ByteArrayOutputStream();
- beforeModel.save(formattedBytes); // "beforeModel" should now be
- // after the formatter
-
+ //Expected results
ByteArrayOutputStream afterBytes = new ByteArrayOutputStream();
afterModel.save(afterBytes);
+ String expectedContents = new String(afterBytes.toByteArray(), UTF_8);
+
+ formatProcessor.formatModel(beforeModel);
- String formattedContents = new String(afterBytes.toByteArray(), UTF_8);
- String expectedContents = new String(formattedBytes.toByteArray(), UTF_8);
+ //Formatted results
+ ByteArrayOutputStream formattedBytes = new ByteArrayOutputStream();
+ beforeModel.save(formattedBytes);
+ String formattedContents = new String(formattedBytes.toByteArray(), UTF_8);
+
assertTrue("Formatted document differs from the expected", fStringCompareUtil.equalsIgnoreLineSeperator(formattedContents, expectedContents));
}
finally {
@@ -171,6 +172,13 @@ public class TestFormatProcessorCSS extends TestCase {
}
/**
+ * file should not change after format
+ */
+ public void testbug367579MultiSpaceAddition() throws UnsupportedEncodingException, IOException, CoreException {
+ formatAndAssertEquals("testfiles/bug367579-MultiSpaceAdittion.css", "testfiles/bug367579-MultiSpaceAdittion.css");
+ }
+
+ /**
* space after / should be removed
*/
public void testBUG163315SlashBeforePrimative2() throws UnsupportedEncodingException, IOException, CoreException {
diff --git a/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/format/testfiles/bug367579-MultiSpaceAdittion.css b/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/format/testfiles/bug367579-MultiSpaceAdittion.css
new file mode 100644
index 0000000..d2bda49
--- /dev/null
+++ b/tests/org.eclipse.wst.css.core.tests/src/org/eclipse/wst/css/core/tests/format/testfiles/bug367579-MultiSpaceAdittion.css
@@ -0,0 +1,3 @@
+.class {
+ background-color: #ccc /*#d4e2fc*/ /*#c3d9ff*/;
+} \ No newline at end of file