Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 16:51:42 -0500
committerJonah Graham2018-11-22 15:34:33 -0500
commit086e6e30b7a4ba995a33da9db14066c3fec0fb9e (patch)
treef975561b33fa52b6f25bb79ac802f82112b6c08c /core
parent871c91ee5e5631ac080750a3643d4f855f5dd5d0 (diff)
downloadorg.eclipse.cdt-086e6e30b7a4ba995a33da9db14066c3fec0fb9e.tar.gz
org.eclipse.cdt-086e6e30b7a4ba995a33da9db14066c3fec0fb9e.tar.xz
org.eclipse.cdt-086e6e30b7a4ba995a33da9db14066c3fec0fb9e.zip
Bug 540373: Fix tests that rely on whitespace at end of line
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/TemplateFormatterTest.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java6
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentSingleAutoEditStrategyTest.java8
4 files changed, 13 insertions, 9 deletions
diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java
index b7f8d6ca22..d7859af4fa 100644
--- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java
+++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java
@@ -156,6 +156,10 @@ public class TestSourceReader {
StringBuilder content = new StringBuilder();
for (String line = br.readLine(); line != null; line = br.readLine()) {
line = line.replaceFirst("^\\s*", ""); // Replace leading whitespace, preserve trailing
+ // Trailing whitespace can be removed by editor/clean-up actions. To enforce whitespace
+ // at end of line, use ${whitspace_eol}, which will be removed, but cause the
+ // whitespace to the left of it to be preserved.
+ line = line.replace("${whitespace_eol}", "");
if (line.startsWith("//")) {
content.append(line.substring(2)).append('\n');
} else {
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/TemplateFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/TemplateFormatterTest.java
index db927b6acc..f3e30a3feb 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/TemplateFormatterTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/TemplateFormatterTest.java
@@ -102,7 +102,7 @@ public class TemplateFormatterTest extends BaseUITestCase {
//}
//for(int var=0; var<max; var++) {
- //
+ // ${whitespace_eol}
//}
public void testForLoopTemplateDefault() throws Exception {
assertFormatterResult();
@@ -113,7 +113,7 @@ public class TemplateFormatterTest extends BaseUITestCase {
//}
//for(int var=0; var<max; var++) {
- //
+ // ${whitespace_eol}
//}
public void testForLoopTemplateMixedIndent() throws Exception {
setOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, DefaultCodeFormatterConstants.MIXED);
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java
index 99f5f62dc1..ddca5ea104 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java
@@ -103,7 +103,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
// /** X
// void foo() {}
- // /**
+ // /** ${whitespace_eol}
// * X
// */
// void foo() {}
@@ -126,7 +126,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
// /** X
// int foo_bar() {}
- // /**
+ // /** ${whitespace_eol}
// * X
// * @return
// */
@@ -506,7 +506,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
// /** X
// int foo_bar();
- // /**
+ // /** ${whitespace_eol}
// * X
// * @return
// */
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentSingleAutoEditStrategyTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentSingleAutoEditStrategyTest.java
index 7e0188500b..fb280c6d0a 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentSingleAutoEditStrategyTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentSingleAutoEditStrategyTest.java
@@ -102,7 +102,7 @@ public class DoxygenCCommentSingleAutoEditStrategyTest extends AbstractAutoEditT
// /// X
// void foo() {}
- // ///
+ // /// ${whitespace_eol}
// /// X
// void foo() {}
public void testAutoDocCommentContent2() throws CoreException {
@@ -192,7 +192,7 @@ public class DoxygenCCommentSingleAutoEditStrategyTest extends AbstractAutoEditT
// C* bar_baz(A a, B b, int c) {}
// class A {}; class B {};
- // ///
+ // /// ${whitespace_eol}
// /// X@param a
// /// @param b
// /// @param c
@@ -271,7 +271,7 @@ public class DoxygenCCommentSingleAutoEditStrategyTest extends AbstractAutoEditT
// {}
// void foo_bar(int x)
- // ///
+ // /// ${whitespace_eol}
// /// X@param x
// {}
public void testAutoDocCommentContent9b() throws CoreException {
@@ -282,7 +282,7 @@ public class DoxygenCCommentSingleAutoEditStrategyTest extends AbstractAutoEditT
// {}
// void foo_bar(int x)
- // ///
+ // /// ${whitespace_eol}
// /// X@param x
// {}
public void testAutoDocCommentContent9c() throws CoreException {

Back to the top