From cbd551eeef1c95ccc99cecebea77a32f58409d13 Mon Sep 17 00:00:00 2001
From: Marc-Andre Laperle <malaperle@omnialabs.net>
Date: Sun, 13 Mar 2011 06:32:17 +0000
Subject: [PATCH] Add CreateLocalVariableQuickFix test to automated tests
 suite, fix the test. Minor clean up.

---
 .../checkers/ProblemBindingCheckerTest.java   |  1 -
 .../core/test/AutomatedIntegrationSuite.java  |  2 ++
 .../CreateLocalVariableQuickFixTest.java      | 31 ++++++++++++++-----
 3 files changed, 26 insertions(+), 8 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
index 173c85c6641..ef4cc85d37a 100644
--- 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
@@ -14,7 +14,6 @@ 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;
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 1070b82d7cb..3ed319422d7 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
@@ -26,6 +26,7 @@ import org.eclipse.cdt.codan.core.internal.checkers.ReturnStyleCheckerTest;
 import org.eclipse.cdt.codan.core.internal.checkers.StatementHasNoEffectCheckerTest;
 import org.eclipse.cdt.codan.core.internal.checkers.SuggestedParenthesisCheckerTest;
 import org.eclipse.cdt.codan.core.internal.checkers.SuspiciousSemicolonCheckerTest;
+import org.eclipse.cdt.codan.internal.checkers.ui.quickfix.CreateLocalVariableQuickFixTest;
 import org.eclipse.cdt.codan.internal.checkers.ui.quickfix.SuggestedParenthesisQuickFixTest;
 
 public class AutomatedIntegrationSuite extends TestSuite {
@@ -62,6 +63,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
 		suite.addTest(CodanFastTestSuite.suite());
 		// quick fixes
 		suite.addTestSuite(SuggestedParenthesisQuickFixTest.class);
+		suite.addTestSuite(CreateLocalVariableQuickFixTest.class);
 		return suite;
 	}
 }
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CreateLocalVariableQuickFixTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CreateLocalVariableQuickFixTest.java
index 7f48b731b67..d1eb6a0b7d8 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CreateLocalVariableQuickFixTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CreateLocalVariableQuickFixTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 Tomasz Wesolowski and others
+ * Copyright (c) 2010, 2011 Tomasz Wesolowski 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
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
 
+import org.eclipse.cdt.codan.internal.checkers.ProblemBindingChecker;
 import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
 
 /**
@@ -22,14 +23,30 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
 		return new QuickFixCreateLocalVariable();
 	}
 
+	@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_FieldResolutionProblem, ProblemBindingChecker.ERR_ID_MethodResolutionProblem,
+				ProblemBindingChecker.ERR_ID_VariableResolutionProblem);
+	}
+
 	// void func() {
 	// aChar = 'a';
 	// }
-	@SuppressWarnings("restriction")
 	public void testChar() {
 		loadcode(getAboveComment());
 		String result = runQuickFixOneFile();
-		assertContainedIn("char aChar;", result);
+		assertContainedIn("char aChar;", result); //$NON-NLS-1$
 	}
 
 	// void func() {
@@ -38,7 +55,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
 	public void testDouble() {
 		loadcode(getAboveComment());
 		String result = runQuickFixOneFile();
-		assertContainedIn("double aDouble;", result);
+		assertContainedIn("double aDouble;", result); //$NON-NLS-1$
 	}
 
 	// void func() {
@@ -47,7 +64,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
 	public void testString() {
 		loadcode(getAboveComment());
 		String result = runQuickFixOneFile();
-		assertContainedIn("const char *aString;", result);
+		assertContainedIn("const char *aString;", result); //$NON-NLS-1$
 	}
 
 	// void func() {
@@ -56,7 +73,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
 	public void testWString() {
 		loadcode(getAboveComment());
 		String result = runQuickFixOneFile();
-		assertContainedIn("const wchar_t *aWString;", result);
+		assertContainedIn("const wchar_t *aWString;", result); //$NON-NLS-1$
 	}
 
 	// void func() {
@@ -65,6 +82,6 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
 	public void testFuncPtr() {
 		loadcode(getAboveComment());
 		String result = runQuickFixOneFile();
-		assertContainedIn("void (*aFuncPtr)();", result);
+		assertContainedIn("void (*aFuncPtr)();", result); //$NON-NLS-1$
 	}
 }