Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2015-02-25 21:37:12 -0500
committerGerrit Code Review @ Eclipse.org2015-03-03 19:36:51 -0500
commit498bfb6509259b8bf9997a66e6710a26a969bf02 (patch)
tree48c0529ca2fa2a491b52a5121bf67a2a17040a4b /codan/org.eclipse.cdt.codan.core.test
parent52794aa29c359bd7968cc1715d77a3466634e55f (diff)
downloadorg.eclipse.cdt-498bfb6509259b8bf9997a66e6710a26a969bf02.tar.gz
org.eclipse.cdt-498bfb6509259b8bf9997a66e6710a26a969bf02.tar.xz
org.eclipse.cdt-498bfb6509259b8bf9997a66e6710a26a969bf02.zip
converted codan test to use comment labels positioning
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.test')
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java41
1 files changed, 14 insertions, 27 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java
index b9c30290bf..98c8ec3b8f 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java
@@ -34,8 +34,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// +a; // error here on line 3
// }
public void testUnaryExpression() throws IOException {
- loadCodeAndRun(getAboveComment());
- checkErrorLine(3);
+ checkSampleAbove();
}
// main() {
@@ -44,8 +43,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// b+a; // error here on line 4
// }
public void testBinaryExpression() {
- loadCodeAndRun(getAboveComment());
- checkErrorLine(4);
+ checkSampleAbove();
}
// main() {
@@ -54,8 +52,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// a=b+a; // no error here
// }
public void testNormalAssignment() {
- loadCodeAndRun(getAboveComment());
- checkNoErrors();
+ checkSampleAbove();
}
// main() {
@@ -73,8 +70,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// a>>=2;
// }
public void testFalsePositives() {
- loadCodeAndRun(getAboveComment());
- checkNoErrors();
+ checkSampleAbove();
}
// main() {
@@ -82,8 +78,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// a; // error here on line 3
// }
public void testIdExpression() {
- loadCodeAndRun(getAboveComment());
- checkErrorLine(3);
+ checkSampleAbove();
}
// main() {
@@ -91,16 +86,14 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// char *p=({char s[]="Some string";&s[0];}); // no error here on line 3
// }
public void testGNUExpressionCompoundStmtFalsePositives() {
- loadCodeAndRun(getAboveComment());
- checkNoErrors();
+ checkSampleAbove();
}
// main() {
// int z=({int a=0; +a; a;}) // error here on line 2
// }
public void testGNUExpressionCompoundStmtInside() {
- loadCodeAndRun(getAboveComment());
- checkErrorLine(2);
+ checkSampleAbove();
}
// main() {
@@ -127,8 +120,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// for (a=b;a;a=a->next);
// }
public void testForTestExpression() {
- loadCodeAndRun(getAboveComment());
- checkNoErrors();
+ checkSampleAbove();
}
// void main() {
@@ -138,18 +130,16 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// (a = z.foo(1)) || (a = z.foo(2));
// }
public void testLazyEvalHack() {
- loadCodeAndRunCpp(getAboveComment());
- checkNoErrors();
+ checkSampleAboveCpp();
}
// main() {
// A a,b;
//
- // b+=a; // error here on line 4
+ // b+=a; // no error here on line 4
// }
public void testOverloadedBinaryExpression() {
- loadCodeAndRun(getAboveComment());
- checkNoErrors();
+ checkSampleAboveCpp();
}
//#define FUNC(a) a
@@ -160,8 +150,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
public void testInMacro() {
IProblemPreference macro = getPreference(StatementHasNoEffectChecker.ER_ID, StatementHasNoEffectChecker.PARAM_MACRO_ID);
macro.setValue(Boolean.TRUE);
- loadCodeAndRun(getAboveComment());
- checkErrorLine(4);
+ checkSampleAbove();
}
//#define FUNC(a) a
@@ -183,8 +172,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
public void testInMacroParamOff() {
IProblemPreference macro = getPreference(StatementHasNoEffectChecker.ER_ID, StatementHasNoEffectChecker.PARAM_MACRO_ID);
macro.setValue(Boolean.FALSE);
- loadCodeAndRun(getAboveComment());
- checkNoErrors();
+ checkSampleAbove();
}
// main() {
@@ -206,7 +194,6 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// *s;
// }
public void testOverloadedOperator_bug399146() {
- loadCodeAndRunCpp(getAboveComment());
- checkNoErrors();
+ checkSampleAboveCpp();
}
}

Back to the top