mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Test for macro parameters
This commit is contained in:
parent
5a6ecb2fb8
commit
ba99f3a2d5
1 changed files with 2 additions and 19 deletions
|
@ -13,10 +13,7 @@ package org.eclipse.cdt.codan.core.internal.checkers;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.CodanRuntime;
|
|
||||||
import org.eclipse.cdt.codan.core.model.IProblem;
|
|
||||||
import org.eclipse.cdt.codan.core.param.IProblemPreference;
|
import org.eclipse.cdt.codan.core.param.IProblemPreference;
|
||||||
import org.eclipse.cdt.codan.core.param.MapProblemPreference;
|
|
||||||
import org.eclipse.cdt.codan.core.test.CheckerTestCase;
|
import org.eclipse.cdt.codan.core.test.CheckerTestCase;
|
||||||
import org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectChecker;
|
import org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectChecker;
|
||||||
|
|
||||||
|
@ -147,7 +144,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
|
||||||
// }
|
// }
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
public void testInMacro() {
|
public void testInMacro() {
|
||||||
IProblemPreference macro = getMapPreference(
|
IProblemPreference macro = getPreference(
|
||||||
StatementHasNoEffectChecker.ER_ID,
|
StatementHasNoEffectChecker.ER_ID,
|
||||||
StatementHasNoEffectChecker.PARAM_MACRO_ID);
|
StatementHasNoEffectChecker.PARAM_MACRO_ID);
|
||||||
macro.setValue(Boolean.TRUE);
|
macro.setValue(Boolean.TRUE);
|
||||||
|
@ -162,25 +159,11 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
|
||||||
// }
|
// }
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
public void testInMacroParamOff() {
|
public void testInMacroParamOff() {
|
||||||
IProblemPreference macro = getMapPreference(
|
IProblemPreference macro = getPreference(
|
||||||
StatementHasNoEffectChecker.ER_ID,
|
StatementHasNoEffectChecker.ER_ID,
|
||||||
StatementHasNoEffectChecker.PARAM_MACRO_ID);
|
StatementHasNoEffectChecker.PARAM_MACRO_ID);
|
||||||
macro.setValue(Boolean.FALSE);
|
macro.setValue(Boolean.FALSE);
|
||||||
loadCodeAndRun(getAboveComment());
|
loadCodeAndRun(getAboveComment());
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param problemId
|
|
||||||
* @param paramId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected IProblemPreference getMapPreference(String problemId,
|
|
||||||
String paramId) {
|
|
||||||
IProblem problem = CodanRuntime.getInstance().getChechersRegistry()
|
|
||||||
.getWorkspaceProfile().findProblem(problemId);
|
|
||||||
IProblemPreference pref = ((MapProblemPreference) problem
|
|
||||||
.getPreference()).getChildDescriptor(paramId);
|
|
||||||
return pref;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue