Allow error types for some Java tests
This commit is contained in:
@@ -44,6 +44,7 @@ import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.java.DescriptorSearchRule;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver;
|
||||
import org.jetbrains.jet.test.TestCaseWithTmpdir;
|
||||
import org.jetbrains.jet.test.util.DescriptorValidator;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.File;
|
||||
@@ -54,6 +55,8 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.jvm.compiler.LoadDescriptorUtil.*;
|
||||
import static org.jetbrains.jet.test.util.DescriptorValidator.ValidationVisitor.ALLOW_ERROR_TYPES;
|
||||
import static org.jetbrains.jet.test.util.DescriptorValidator.ValidationVisitor.FORBID_ERROR_TYPES;
|
||||
import static org.jetbrains.jet.test.util.NamespaceComparator.*;
|
||||
|
||||
/*
|
||||
@@ -114,7 +117,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndContext = compileJavaAndLoadTestNamespaceAndBindingContextFromBinary(
|
||||
srcFiles, compiledDir, getTestRootDisposable(), ConfigurationKind.JDK_ONLY);
|
||||
|
||||
checkJavaNamespace(getTxtFile(javaFileName), javaNamespaceAndContext.first, javaNamespaceAndContext.second, configuration);
|
||||
checkJavaNamespace(getTxtFile(javaFileName), javaNamespaceAndContext.first, javaNamespaceAndContext.second, configuration, FORBID_ERROR_TYPES);
|
||||
}
|
||||
|
||||
protected void doTestSourceJava(@NotNull String javaFileName) throws Exception {
|
||||
@@ -128,7 +131,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndContext = loadTestNamespaceAndBindingContextFromJavaRoot(
|
||||
tmpdir, getTestRootDisposable(), ConfigurationKind.JDK_ONLY);
|
||||
|
||||
checkJavaNamespace(expectedFile, javaNamespaceAndContext.first, javaNamespaceAndContext.second, DONT_INCLUDE_METHODS_OF_OBJECT);
|
||||
checkJavaNamespace(expectedFile, javaNamespaceAndContext.first, javaNamespaceAndContext.second, DONT_INCLUDE_METHODS_OF_OBJECT, ALLOW_ERROR_TYPES);
|
||||
}
|
||||
|
||||
protected void doTestJavaAgainstKotlin(String expectedFileName) throws Exception {
|
||||
@@ -172,7 +175,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
LoadDescriptorUtil.TEST_PACKAGE_FQNAME, DescriptorSearchRule.INCLUDE_KOTLIN);
|
||||
assert namespaceDescriptor != null : "Test namespace not found";
|
||||
|
||||
checkJavaNamespace(expectedFile, namespaceDescriptor, trace.getBindingContext(), DONT_INCLUDE_METHODS_OF_OBJECT);
|
||||
checkJavaNamespace(expectedFile, namespaceDescriptor, trace.getBindingContext(), DONT_INCLUDE_METHODS_OF_OBJECT, FORBID_ERROR_TYPES);
|
||||
}
|
||||
|
||||
private static void checkForLoadErrorsAndCompare(
|
||||
@@ -220,12 +223,13 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
final File txtFile,
|
||||
final NamespaceDescriptor javaNamespace,
|
||||
BindingContext bindingContext,
|
||||
final Configuration configuration
|
||||
final Configuration configuration,
|
||||
final DescriptorValidator.ValidationVisitor validationStrategy
|
||||
) {
|
||||
checkForLoadErrorsAndCompare(javaNamespace, bindingContext, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
validateAndCompareNamespaceWithFile(javaNamespace, configuration, txtFile);
|
||||
validateAndCompareNamespaceWithFile(validationStrategy, javaNamespace, configuration, txtFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user