mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
Improved diagnostic messages in tests.
Change-Id: I031061fa7ce8c7cf5af76f229ff9b93c411d1be3
This commit is contained in:
parent
f8488ac157
commit
64bd99d429
3 changed files with 28 additions and 10 deletions
|
@ -365,7 +365,8 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
NameCollector col = new NameCollector();
|
NameCollector col = new NameCollector();
|
||||||
ast.accept(col);
|
ast.accept(col);
|
||||||
for (IASTName n : col.nameList) {
|
for (IASTName n : col.nameList) {
|
||||||
assertFalse("ProblemBinding for " + n.getRawSignature(), n.resolveBinding() instanceof IProblemBinding);
|
if (n.resolveBinding() instanceof IProblemBinding)
|
||||||
|
fail("ProblemBinding for " + formatForPrinting(n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,6 @@ import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.EScopeKind;
|
import org.eclipse.cdt.core.dom.ast.EScopeKind;
|
||||||
|
@ -54,6 +52,8 @@ import org.eclipse.cdt.core.parser.IProblem;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For testing PDOM binding CPP language resolution
|
* For testing PDOM binding CPP language resolution
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,14 +24,8 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import junit.framework.AssertionFailedError;
|
|
||||||
import junit.framework.Test;
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import junit.framework.TestFailure;
|
|
||||||
import junit.framework.TestResult;
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
@ -54,6 +48,13 @@ import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
|
||||||
|
import junit.framework.AssertionFailedError;
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestFailure;
|
||||||
|
import junit.framework.TestResult;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
public class BaseTestCase extends TestCase {
|
public class BaseTestCase extends TestCase {
|
||||||
private static final String DEFAULT_INDEXER_TIMEOUT_SEC = "10";
|
private static final String DEFAULT_INDEXER_TIMEOUT_SEC = "10";
|
||||||
private static final String INDEXER_TIMEOUT_PROPERTY = "indexer.timeout";
|
private static final String INDEXER_TIMEOUT_PROPERTY = "indexer.timeout";
|
||||||
|
@ -368,4 +369,20 @@ public class BaseTestCase extends TestCase {
|
||||||
protected static void assertVariableValue(IVariable var, long expectedValue) {
|
protected static void assertVariableValue(IVariable var, long expectedValue) {
|
||||||
assertValue(var.getInitialValue(), expectedValue);
|
assertValue(var.getInitialValue(), expectedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static String formatForPrinting(IASTName name) {
|
||||||
|
String signature = name.getRawSignature();
|
||||||
|
boolean saved = CPPASTNameBase.sAllowNameComputation;
|
||||||
|
CPPASTNameBase.sAllowNameComputation = true;
|
||||||
|
try {
|
||||||
|
String nameStr = name.toString();
|
||||||
|
if (signature.replace(" ", "").equals(nameStr.replace(" ", "")))
|
||||||
|
return signature;
|
||||||
|
return nameStr + " in " + signature;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
return signature;
|
||||||
|
} finally {
|
||||||
|
CPPASTNameBase.sAllowNameComputation = saved;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue