diff options
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 |