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

Bug 527709 - [Checker] Test suite fails on Windows

Change-Id: I70cf18245dc8dba14493f212c932ea08ae85a6cf
Signed-off-by: Hansruedi Patzen <hansruedi.patzen@hsr.ch>
This commit is contained in:
Hansruedi Patzen 2017-11-24 10:44:11 +01:00
parent 93a5fcaa2a
commit 19b4848e08
3 changed files with 8 additions and 2 deletions

View file

@ -76,6 +76,6 @@ public class AssignmentToItselfCheckerTest extends CheckerTestCase {
int start = marker.getAttribute(IMarker.CHAR_START, -1);
int end = marker.getAttribute(IMarker.CHAR_END, -1);
// The offset should start at the beginning of the expression "x = x"
assertEquals("x\n = x", code.substring(start, end));
assertEquals("x" + NL + " = x", code.substring(start, end));
}
}

View file

@ -174,7 +174,7 @@ public class CodanTestCase extends BaseTestCase {
}
protected String getAboveComment() {
return getContents(1)[0].toString();
return getContents(1)[0].toString().replaceAll("\\r\\n|\\n", NL);
}
protected StringBuilder[] getContents(int sections) {

View file

@ -73,6 +73,12 @@ public class BaseTestCase extends TestCase {
protected static final int GCC_MAJOR_VERSION_FOR_TESTS = 5;
protected static final int GCC_MINOR_VERSION_FOR_TESTS = 1;
/**
* This provides the systems new line separator. Use this if you do String comparisons in tests
* instead of hard coding '\n' or '\r\n' respectively.
*/
protected static final String NL = System.getProperty("line.separator");
private boolean fExpectFailure;
private int fBugNumber;
private int fExpectedLoggedNonOK;