Add ability to reuse one diagnostic test file for old and new inference
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -146,14 +146,14 @@ public class CheckerTestUtilTest extends KotlinTestWithEnvironment {
|
||||
|
||||
String expectedText = CheckerTestUtil.addDiagnosticMarkersToText(
|
||||
psiFile,
|
||||
CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile, false, null, null)
|
||||
CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile, false, null, null, false)
|
||||
).toString();
|
||||
|
||||
List<DiagnosedRange> diagnosedRanges = Lists.newArrayList();
|
||||
CheckerTestUtil.parseDiagnosedRanges(expectedText, diagnosedRanges);
|
||||
|
||||
List<ActualDiagnostic> actualDiagnostics =
|
||||
CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile, false, null, null);
|
||||
CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, psiFile, false, null, null, false);
|
||||
actualDiagnostics.sort(CheckerTestUtil.DIAGNOSTIC_COMPARATOR);
|
||||
|
||||
makeTestData(actualDiagnostics, diagnosedRanges);
|
||||
@@ -181,6 +181,20 @@ public class CheckerTestUtilTest extends KotlinTestWithEnvironment {
|
||||
public void unexpectedDiagnostic(CheckerTestUtil.TextDiagnostic diagnostic, int actualStart, int actualEnd) {
|
||||
actualMessages.add(unexpected(diagnostic.getDescription(), actualStart, actualEnd));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uncheckedDiagnostic(CheckerTestUtil.TextDiagnostic diagnostic, int expectedStart, int expectedEnd) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseDiagnosticsForNI() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWithNewInferenceDirective() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
assertEquals(listToString(expectedMessages), listToString(actualMessages));
|
||||
|
||||
Reference in New Issue
Block a user