bug with multifile frontend tests fixed
This commit is contained in:
@@ -2,6 +2,7 @@ package org.jetbrains.jet.checkers;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetLiteFixture;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
@@ -79,7 +80,7 @@ public class CheckerTestUtilTest extends JetLiteFixture {
|
||||
this.expected = expectedMessages;
|
||||
}
|
||||
|
||||
public void test(PsiFile psiFile) {
|
||||
public void test(final @NotNull PsiFile psiFile) {
|
||||
BindingContext bindingContext = AnalyzerFacade.analyzeOneNamespaceWithJavaIntegration(
|
||||
((JetFile) psiFile).getRootNamespace(),
|
||||
JetControlFlowDataTraceFactory.EMPTY);
|
||||
@@ -88,6 +89,9 @@ public class CheckerTestUtilTest extends JetLiteFixture {
|
||||
|
||||
List<CheckerTestUtil.DiagnosedRange> diagnosedRanges = Lists.newArrayList();
|
||||
CheckerTestUtil.parseDiagnosedRanges(expectedText, diagnosedRanges);
|
||||
for (CheckerTestUtil.DiagnosedRange diagnosedRange : diagnosedRanges) {
|
||||
diagnosedRange.setFile(psiFile);
|
||||
}
|
||||
|
||||
List<Diagnostic> diagnostics = CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile);
|
||||
Collections.sort(diagnostics, CheckerTestUtil.DIAGNOSTIC_COMPARATOR);
|
||||
@@ -98,6 +102,12 @@ public class CheckerTestUtilTest extends JetLiteFixture {
|
||||
final List<String> actualMessages = Lists.newArrayList();
|
||||
|
||||
CheckerTestUtil.diagnosticsDiff(diagnosedRanges, diagnostics, new CheckerTestUtil.DiagnosticDiffCallbacks() {
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiFile getFile() {
|
||||
return psiFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void missingDiagnostic(String type, int expectedStart, int expectedEnd) {
|
||||
String message = "Missing " + type + " at " + expectedStart + " to " + expectedEnd;
|
||||
|
||||
@@ -52,10 +52,19 @@ public class JetDiagnosticsTest extends JetLiteFixture {
|
||||
expectedText = textWithMarkers;
|
||||
clearText = CheckerTestUtil.parseDiagnosedRanges(expectedText, diagnosedRanges);
|
||||
jetFile = createCheckAndReturnPsiFile(fileName, clearText);
|
||||
for (CheckerTestUtil.DiagnosedRange diagnosedRange : diagnosedRanges) {
|
||||
diagnosedRange.setFile(jetFile);
|
||||
}
|
||||
}
|
||||
|
||||
public void getActualText(BindingContext bindingContext, StringBuilder actualText) {
|
||||
CheckerTestUtil.diagnosticsDiff(diagnosedRanges, CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, jetFile), new CheckerTestUtil.DiagnosticDiffCallbacks() {
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiFile getFile() {
|
||||
return jetFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void missingDiagnostic(String type, int expectedStart, int expectedEnd) {
|
||||
String message = "Missing " + type + DiagnosticUtils.atLocation(jetFile, new TextRange(expectedStart, expectedEnd));
|
||||
@@ -95,7 +104,7 @@ public class JetDiagnosticsTest extends JetLiteFixture {
|
||||
bindingContext = AnalyzerFacade.analyzeNamespacesWithJavaIntegration(getProject(), namespaces, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY);
|
||||
}
|
||||
else {
|
||||
bindingContext = AnalyzingUtils.analyzeNamespaces(getProject(), Configuration.EMPTY, namespaces, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY, JetSemanticServices.createSemanticServices(getProject()));
|
||||
bindingContext = AnalyzingUtils.analyzeNamespaces(getProject(), Configuration.EMPTY, namespaces, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY);
|
||||
}
|
||||
|
||||
StringBuilder actualText = new StringBuilder();
|
||||
|
||||
Reference in New Issue
Block a user