diff options
author | Salvador Zalapa | 2013-01-28 16:37:22 +0000 |
---|---|---|
committer | Nick Sandonato | 2013-01-29 19:39:56 +0000 |
commit | e801e715d09a21f75d88c0d0467950972401b8d1 (patch) | |
tree | acd84188dd24d094c3e168b4e4865bdd0b079e20 | |
parent | 6845de30a516829a8a04cf4761d08d7ae392502d (diff) | |
download | webtools.sourceediting.tests-e801e715d09a21f75d88c0d0467950972401b8d1.tar.gz webtools.sourceediting.tests-e801e715d09a21f75d88c0d0467950972401b8d1.tar.xz webtools.sourceediting.tests-e801e715d09a21f75d88c0d0467950972401b8d1.zip |
[367579] [formatting] Formatting successive comments inserts spacesv201301291945201301291945
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 fd1bdbd08..546121e25 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 000000000..d2bda49de --- /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 |