Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java')
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java27
1 files changed, 23 insertions, 4 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 a5b01093749..f1349c634b5 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
@@ -241,10 +241,20 @@ public class ReturnCheckerTest extends CheckerTestCase {
// {
// switch (g()) {
// case 1: return 1;
-// case 2:
-// return 0;
+// case 2: return 0;
// }
- public void testBranchesSwitch_Bug343767() {
+ public void testBranchesSwitch_Bug343767a() {
+ loadCodeAndRunCpp(getAboveComment());
+ checkErrorLine(1);
+ }
+// int f()
+// {
+// switch (g()) {
+// case 1: return 1;
+// case 2: return 0;
+// default: return -1;
+// }
+ public void testBranchesSwitch_Bug343767b() {
loadCodeAndRunCpp(getAboveComment());
checkNoErrors();
}
@@ -429,4 +439,13 @@ public class ReturnCheckerTest extends CheckerTestCase {
// Just check that codan runs without any exceptions being thrown.
loadCodeAndRunCpp(getAboveComment());
}
-} \ No newline at end of file
+
+ // int foo(int x) { // no warning
+ // switch (x) {
+ // }
+ // }
+ public void testEmptySwitch_455828() throws Exception {
+ loadCodeAndRunCpp(getAboveComment());
+ checkErrorLine(1);
+ }
+}

Back to the top