Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2011-04-24 22:13:33 -0400
committerAlena Laskavaia2011-04-24 22:13:33 -0400
commit2c65df3e22121b1f5764bbb1e9bd0c425163f775 (patch)
tree59cc4e9c905f0934941a03921cad6e8480a99460 /codan/org.eclipse.cdt.codan.core.test
parentb8b9084ce272fddef85a52d50cc26fcebb598223 (diff)
downloadorg.eclipse.cdt-2c65df3e22121b1f5764bbb1e9bd0c425163f775.tar.gz
org.eclipse.cdt-2c65df3e22121b1f5764bbb1e9bd0c425163f775.tar.xz
org.eclipse.cdt-2c65df3e22121b1f5764bbb1e9bd0c425163f775.zip
Bug 342906 - No warning if only one of an if/else pair has a return statement
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/ReturnCheckerTest.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
index abf5e92012..27551954fe 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
@@ -186,4 +186,28 @@ public class ReturnCheckerTest extends CheckerTestCase {
loadCodeAndRunCpp(getAboveComment());
checkErrorLine(1);
}
+
+// int f()
+// {
+// if (g())
+// h();
+// else
+// return 0;
+// }
+ public void testBranches_Bug342906() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(1);
+ }
+
+// int f()
+// {
+// switch (g()) {
+// case 1: h(); break;
+// case 2:
+// return 0;
+// }
+ public void testSwitch() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(1);
+ }
} \ No newline at end of file

Back to the top