Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2011-05-01 21:30:34 -0400
committerAlena Laskavaia2011-05-01 21:30:34 -0400
commitf895d0411b0f1805e5e36008012ea6b25c7d947f (patch)
treec8aaf032e4eedaa82170dd247eb55b013a908f20 /codan/org.eclipse.cdt.codan.core.test
parent55b32bcd97e8fdbe83a7b83e7521c92bd601bb29 (diff)
downloadorg.eclipse.cdt-f895d0411b0f1805e5e36008012ea6b25c7d947f.tar.gz
org.eclipse.cdt-f895d0411b0f1805e5e36008012ea6b25c7d947f.tar.xz
org.eclipse.cdt-f895d0411b0f1805e5e36008012ea6b25c7d947f.zip
Bug 335901 - Suspicious semicolon is not reported in "else" clause
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/SuspiciousSemicolonCheckerTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/SuspiciousSemicolonCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/SuspiciousSemicolonCheckerTest.java
index ee0b9bf82a..2b4d1d39e9 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/SuspiciousSemicolonCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/SuspiciousSemicolonCheckerTest.java
@@ -11,6 +11,7 @@
package org.eclipse.cdt.codan.core.internal.checkers;
import org.eclipse.cdt.codan.core.test.CheckerTestCase;
+import org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonChecker;
public class SuspiciousSemicolonCheckerTest extends CheckerTestCase {
@Override
@@ -150,4 +151,16 @@ public class SuspiciousSemicolonCheckerTest extends CheckerTestCase {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
+
+ // main() {
+ // if (false)
+ // ; // only this one is reported
+ // else
+ // ;
+ // }
+ public void testIfElse() {
+ setPreferenceValue(SuspiciousSemicolonChecker.ER_ID, SuspiciousSemicolonChecker.PARAM_ALFTER_ELSE, Boolean.TRUE);
+ loadCodeAndRun(getAboveComment());
+ checkErrorLines(3, 5);
+ }
}

Back to the top