Skip to main content
summaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAlena Laskavaia2010-05-24 17:52:00 -0400
committerAlena Laskavaia2010-05-24 17:52:00 -0400
commitdc1e7535ae9bf445a3f4be182c7ed54639ff11f0 (patch)
treee9c70d7157e8a9cdc708686b062d896f8c962058 /codan
parentf918a234f1c93340b1085b4748807ea026294ef3 (diff)
downloadorg.eclipse.cdt-dc1e7535ae9bf445a3f4be182c7ed54639ff11f0.tar.gz
org.eclipse.cdt-dc1e7535ae9bf445a3f4be182c7ed54639ff11f0.tar.xz
org.eclipse.cdt-dc1e7535ae9bf445a3f4be182c7ed54639ff11f0.zip
Renamed a test case to match the checker
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java89
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java4
2 files changed, 91 insertions, 2 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
new file mode 100644
index 0000000000..679583426a
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Alena Laskavaia
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alena Laskavaia - initial API and implementation
+ * Felipe Martinez - ReturnCheckerTest implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.core.internal.checkers;
+
+import org.eclipse.cdt.codan.core.test.CheckerTestCase;
+
+/**
+ * Test for {@see ReturnCheckerTest} class
+ *
+ */
+public class ReturnCheckerTest extends CheckerTestCase {
+
+
+// dummy() {
+// return; // error here on line 2
+// }
+ public void testDummyFunction() {
+ loadCodeAndRun(getAboveComment());
+ checkNoErrors(); // because return type if not defined, usually people don't care
+ }
+
+
+// void void_function(void) {
+// return; // no error here
+// }
+ public void testVoidFunction() {
+ loadCodeAndRun(getAboveComment());
+ checkNoErrors();
+ }
+
+
+// int integer_return_function(void) {
+// if (global) {
+// if (global == 100) {
+// return; // error here on line 4
+// }
+// }
+// }
+ public void testBasicTypeFunction() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(4);
+ }
+
+//
+// struct My_Struct {
+// int a;
+// };
+//
+// struct My_Struct struct_return_function(void) {
+// return; // error here on line 6
+// }
+ public void testUserDefinedFunction() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(6);
+ }
+
+
+// typedef unsigned int uint8_t;
+//
+// uint8_t return_typedef(void) {
+// return; // error here on line 4
+// }
+ public void testTypedefReturnFunction() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(4);
+ }
+
+
+// typedef unsigned int uint8_t;
+//
+// uint8_t (*return_fp_no_typedef(void))(void)
+// {
+// return; // error here on line 5
+// }
+ public void testFunctionPointerReturnFunction() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(5);
+ }
+
+} \ No newline at end of file
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java
index cfaa138dd5..92030753f8 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java
@@ -15,7 +15,7 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.codan.core.internal.checkers.CatchByReferenceTest;
-import org.eclipse.cdt.codan.core.internal.checkers.ExpressionRequiredInReturnCheckerTest;
+import org.eclipse.cdt.codan.core.internal.checkers.ReturnCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.StatementHasNoEffectCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.SuggestedParenthesisCheckerTest;
@@ -39,7 +39,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
final AutomatedIntegrationSuite suite = new AutomatedIntegrationSuite();
suite.addTestSuite(StatementHasNoEffectCheckerTest.class);
suite.addTestSuite(SuggestedParenthesisCheckerTest.class);
- suite.addTestSuite(ExpressionRequiredInReturnCheckerTest.class);
+ suite.addTestSuite(ReturnCheckerTest.class);
suite.addTestSuite(CatchByReferenceTest.class);
suite.addTest(CodanFastTestSuite.suite());
return suite;

Back to the top