Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java')
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java78
1 files changed, 78 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java
new file mode 100644
index 00000000000..173c85c6641
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ProblemBindingCheckerTest.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Marc-Andre Laperle and others.
+ * 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:
+ * Marc-Andre Laperle - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.core.internal.checkers;
+
+import org.eclipse.cdt.codan.core.test.CheckerTestCase;
+import org.eclipse.cdt.codan.internal.checkers.ProblemBindingChecker;
+
+public class ProblemBindingCheckerTest extends CheckerTestCase {
+ // @Override
+ @Override
+ public boolean isCpp() {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.codan.core.test.CodanTestCase#setUp()
+ */
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ enableProblems(ProblemBindingChecker.ERR_ID_AmbiguousProblem, ProblemBindingChecker.ERR_ID_Candidates,
+ ProblemBindingChecker.ERR_ID_CircularReferenceProblem, ProblemBindingChecker.ERR_ID_FieldResolutionProblem,
+ ProblemBindingChecker.ERR_ID_FunctionResolutionProblem, ProblemBindingChecker.ERR_ID_InvalidArguments,
+ ProblemBindingChecker.ERR_ID_InvalidTemplateArgumentsProblem, ProblemBindingChecker.ERR_ID_LabelStatementNotFoundProblem,
+ ProblemBindingChecker.ERR_ID_MemberDeclarationNotFoundProblem, ProblemBindingChecker.ERR_ID_MethodResolutionProblem,
+ ProblemBindingChecker.ERR_ID_OverloadProblem, ProblemBindingChecker.ERR_ID_RedeclarationProblem,
+ ProblemBindingChecker.ERR_ID_RedefinitionProblem, ProblemBindingChecker.ERR_ID_TypeResolutionProblem,
+ ProblemBindingChecker.ERR_ID_VariableResolutionProblem);
+ }
+
+ // int main () {
+ // struct X {} x;
+ // fun(x.y);
+ // }
+ public void testBug338683FieldInFunctionCall() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(3, ProblemBindingChecker.ERR_ID_FieldResolutionProblem);
+ }
+
+ // int main () {
+ // struct X {} x;
+ // x.b(
+ // x.y(),
+ // x.y(
+ // x.y),
+ // x.y(
+ // x.y(
+ // a,
+ // fun(
+ // x.b(),
+ // x.y,
+ // a.b()))));
+ // }
+ public void testBug338683VariousFieldMethodCombinations() {
+ loadCodeAndRun(getAboveComment());
+ checkErrorLine(3, ProblemBindingChecker.ERR_ID_MethodResolutionProblem);
+ checkErrorLine(4, ProblemBindingChecker.ERR_ID_MethodResolutionProblem);
+ checkErrorLine(5, ProblemBindingChecker.ERR_ID_MethodResolutionProblem);
+ checkErrorLine(6, ProblemBindingChecker.ERR_ID_FieldResolutionProblem);
+ checkErrorLine(7, ProblemBindingChecker.ERR_ID_MethodResolutionProblem);
+ checkErrorLine(8, ProblemBindingChecker.ERR_ID_MethodResolutionProblem);
+ checkErrorLine(9, ProblemBindingChecker.ERR_ID_VariableResolutionProblem);
+ checkErrorLine(10, ProblemBindingChecker.ERR_ID_FunctionResolutionProblem);
+ checkErrorLine(11, ProblemBindingChecker.ERR_ID_MethodResolutionProblem);
+ checkErrorLine(12, ProblemBindingChecker.ERR_ID_FieldResolutionProblem);
+ checkErrorLine(13, ProblemBindingChecker.ERR_ID_MethodResolutionProblem);
+ }
+}

Back to the top