1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 540373: Fix tests that rely on whitespace at end of line

Change-Id: I2aa5d28e5fbd9ba1f12f6ec275ea1474730efe46
This commit is contained in:
Jonah Graham 2018-11-20 21:51:42 +00:00
parent 871c91ee5e
commit 086e6e30b7
4 changed files with 13 additions and 9 deletions

View file

@ -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 {

View file

@ -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);

View file

@ -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
// */

View file

@ -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 {