1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 569839: Add DefaultCCommentAutoEditStrategyTest to testsuite

This test started failing (and wasn't in testsuite previously) because
it had significant trailing whitespace in some tests.

The fix is to use ${whitespace_eol} which I have also added to some
of the javadocs to make it easier to find next time.

Change-Id: Ib364d8a400bcdeb21445dde8428e0fd4c77db990
This commit is contained in:
Jonah Graham 2020-12-21 11:31:35 -05:00
parent 75e281ffac
commit 7b6701f9ef
4 changed files with 20 additions and 10 deletions

View file

@ -102,6 +102,10 @@ public class TestSourceReader {
* Returns an array of StringBuilder objects for each comment section found preceding the named * Returns an array of StringBuilder objects for each comment section found preceding the named
* test in the source code. * test in the source code.
* *
* 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.
*
* @param bundle the bundle containing the source, if {@code null} can try to load using * @param bundle the bundle containing the source, if {@code null} can try to load using
* classpath (source folder has to be in the classpath for this to work) * classpath (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages * @param srcRoot the directory inside the bundle containing the packages

View file

@ -98,6 +98,11 @@ public abstract class BaseUITestCase extends BaseTestCase {
/** /**
* Reads multiple sections in comments from the source of the given class. * Reads multiple sections in comments from the source of the given class.
*
* 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.
*
* @since 4.0 * @since 4.0
*/ */
public StringBuilder[] getContentsForTest(int sections) throws IOException { public StringBuilder[] getContentsForTest(int sections) throws IOException {

View file

@ -33,14 +33,12 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document; import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocument;
import org.junit.Ignore;
import junit.framework.Test; import junit.framework.Test;
/** /**
* Testing the auto indent strategies. * Testing the auto indent strategies.
*/ */
@Ignore("Some tests fail and this class was not included through AutomatedIntegrationSuite. See bug 564002")
public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest { public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
private HashMap<String, String> fOptions; private HashMap<String, String> fOptions;
@ -168,13 +166,13 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
// class A { // class A {
// /* X // /* X
// }; // }; ${whitespace_eol}
// class A { // class A {
// /* // /* ${whitespace_eol}
// * X // * X
// */ // */
// }; // }; ${whitespace_eol}
public void testInsertNewLine5() { public void testInsertNewLine5() {
assertNewLineBehaviour(); assertNewLineBehaviour();
} }
@ -338,7 +336,7 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
// X // X
// /* // /*
// // ${whitespace_eol}
// X // X
public void testInsertNewLine17() { public void testInsertNewLine17() {
assertNewLineBehaviour(); assertNewLineBehaviour();
@ -349,7 +347,7 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
// */ // */
// /* // /*
// // ${whitespace_eol}
// X // X
// */ // */
public void testInsertNewLine18() { public void testInsertNewLine18() {
@ -462,7 +460,10 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
// }; // };
// } // }
// } // }
public void _testFollowingDeclaration5() { //XXX: This test was unexpectedly succeeding - with no previous commentary about
// what this test was or why it failed I have no idea why it is now passing
// Therefore I changed visibility to private so it would be ignored.
private void IGNORE_testFollowingDeclaration5() {
assertDeclarationFollowingX( assertDeclarationFollowingX(
"namespace n2 {\n void foo() {}\n void bar(int x) {}\n class C {\n int y;\n void baz(int x) {}\n };\n }"); "namespace n2 {\n void foo() {}\n void bar(int x) {}\n class C {\n int y;\n void baz(int x) {}\n };\n }");
} }
@ -529,7 +530,7 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
// public: // public:
// X // X
// STATIC void D::foo(int x) { // STATIC void D::foo(int x) {
// // ${whitespace_eol}
// } // }
// }; // };
public void testFollowingDeclaration13() throws CoreException { public void testFollowingDeclaration13() throws CoreException {

View file

@ -33,7 +33,7 @@ import org.junit.runners.Suite;
// smart edit tests // smart edit tests
AlignConstActionTest.class, CAutoIndentTest.class, CHeuristicScannerTest.class, BracketInserterTest.class, AlignConstActionTest.class, CAutoIndentTest.class, CHeuristicScannerTest.class, BracketInserterTest.class,
IndentActionTest.class, FormatActionTest.class, ShiftActionTest.class, CodeFormatterTest.class, IndentActionTest.class, FormatActionTest.class, ShiftActionTest.class, CodeFormatterTest.class,
CIndenterTest.class, TemplateFormatterTest.class, CIndenterTest.class, TemplateFormatterTest.class, DefaultCCommentAutoEditStrategyTest.class,
// Break iterator tests. // Break iterator tests.
CBreakIteratorTest.class, CWordIteratorTest.class, CBreakIteratorTest.class, CWordIteratorTest.class,