diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ExpressionRequiredInReturnCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ExpressionRequiredInReturnCheckerTest.java
new file mode 100644
index 00000000000..292313184b8
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ExpressionRequiredInReturnCheckerTest.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * 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 - ExpressionRequiredInReturnCheckerTest implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.core.internal.checkers;
+
+import org.eclipse.cdt.codan.core.test.CheckerTestCase;
+
+/**
+ * Test for {@see ExpressionRequiredInReturnCheckerTest} class
+ *
+ */
+public class ExpressionRequiredInReturnCheckerTest extends CheckerTestCase {
+ /*-
+
+ dummy() {
+ return; // error here on line 2
+ }
+
+ */
+ public void testDummyFunction() {
+ load("test1.c");
+ runOnFile();
+ checkNoErrors(); // because return type if not defined, usually people don't care
+ }
+
+ /*-
+
+ void void_function(void) {
+ return; // no error here
+ }
+
+ */
+ public void testVoidFunction() {
+ load("test2.c");
+ runOnFile();
+ checkNoErrors();
+ }
+
+ /*-
+
+ int integer_return_function(void) {
+ if (global) {
+ if (global == 100) {
+ return; // error here on line 4
+ }
+ }
+ }
+
+ */
+ public void testBasicTypeFunction() {
+ load("test3.c");
+ runOnFile();
+ checkErrorLine(4);
+ }
+
+ /*-
+
+ struct My_Struct {
+ int a;
+ };
+
+ struct My_Struct struct_return_function(void) {
+ return; // error here on line 6
+ }
+
+
+ */
+ public void testUserDefinedFunction() {
+ load("test4.c");
+ runOnFile();
+ checkErrorLine(6);
+ }
+
+ /*-
+
+ typedef unsigned int uint8_t;
+
+ uint8_t return_typedef(void) {
+ return; // error here on line 4
+ }
+
+ */
+ public void testTypedefReturnFunction() {
+ load("test5.c");
+ runOnFile();
+ checkErrorLine(4);
+ }
+
+ /*-
+
+ typedef unsigned int uint8_t;
+
+ uint8_t (*return_fp_no_typedef(void))(void)
+ {
+ return; // error here on line 5
+ }
+
+ */
+ public void testFunctionPointerReturnFunction() {
+ load("test6.c");
+ runOnFile();
+ 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 2a18383b911..430b620ac04 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
@@ -14,6 +14,7 @@ package org.eclipse.cdt.codan.core.test;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.cdt.codan.core.internal.checkers.ExpressionRequiredInReturnCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.StatementHasNoEffectCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.SuggestedParenthesisCheckerTest;
@@ -37,6 +38,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
final AutomatedIntegrationSuite suite = new AutomatedIntegrationSuite();
suite.addTestSuite(StatementHasNoEffectCheckerTest.class);
suite.addTestSuite(SuggestedParenthesisCheckerTest.class);
+ suite.addTestSuite(ExpressionRequiredInReturnCheckerTest.class);
return suite;
}
}