Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2016-01-07 23:12:51 -0500
committerElena Laskavaia2016-01-11 12:49:09 -0500
commit05daa126a0b6c09907dbe5f842156ec9d15d9d44 (patch)
treec5b260c579b4b556a7963f0bddfd518a196dcc52 /codan/org.eclipse.cdt.codan.core.test
parent12843ef1d7d1f60504f58e79c11693210fd8b735 (diff)
downloadorg.eclipse.cdt-05daa126a0b6c09907dbe5f842156ec9d15d9d44.tar.gz
org.eclipse.cdt-05daa126a0b6c09907dbe5f842156ec9d15d9d44.tar.xz
org.eclipse.cdt-05daa126a0b6c09907dbe5f842156ec9d15d9d44.zip
Bug 383576 - Ability to ignore codan errors using line comments
Change-Id: I806e1787fb6cc3be8865cee1d397d581ae4acd8e Signed-off-by: Alena Laskavaia <elaskavaia.cdt@gmail.com>
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/AssignmentInConditionCheckerTest.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/AssignmentInConditionCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/AssignmentInConditionCheckerTest.java
index 8b7be0ecb6..f3efc03bc2 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/AssignmentInConditionCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/AssignmentInConditionCheckerTest.java
@@ -107,4 +107,44 @@ public class AssignmentInConditionCheckerTest extends CheckerTestCase {
String arg = CodanProblemMarker.getProblemArgument(marker, 0);
assertEquals("a=b", arg); //$NON-NLS-1$
}
+
+ // main() {
+ // int i;
+ // while (i=b()) { // @suppress("Assignment in condition")
+ // }
+ // }
+ public void test_while2supp() {
+ loadCodeAndRun(getAboveComment());
+ checkNoErrors();
+ }
+
+ // main() {
+ // int i;
+ // while (i=b()) { /* @suppress("Assignment in condition") */
+ // }
+ // }
+ public void test_while3supp() {
+ loadCodeAndRun(getAboveComment());
+ checkNoErrors();
+ }
+
+ // #define LOOP() while (i=b() /* @suppress("Assignment in condition") */ ) { }
+ // main() {
+ // int i;
+ // LOOP();
+ // }
+ public void test_whileMacroSupp() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(4); // TODO: suppression does not work in macro body now
+ }
+
+ // #define LOOP() while (i=b()) { }
+ // main() {
+ // int i;
+ // LOOP(); // err
+ // }
+ public void test_whileMacro() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(4);
+ }
}

Back to the top