Cleanup test utilities in JvmResolveUtil and GenerationUtils

Simplify usages and fix some warnings along the way.

Rename:
- analyzeFilesWithJavaIntegration, analyzeOneFileWithJavaIntegration -> analyze
- analyzeFilesWithJavaIntegrationAndCheckForErrors,
  analyzeOneFileWithJavaIntegrationAndCheckForErrors -> analyzeAndCheckForErrors
- compileFilesGetGenerationState, compileManyFilesGetGenerationStateForTest ->
  compileFiles
- compileFileGetGenerationStateForTest -> compileFile
- compileFileGetClassFileFactoryForTest -> compileFileTo
This commit is contained in:
Alexander Udalov
2016-05-19 17:43:09 +03:00
parent 8a00cabce6
commit 0124cb64f0
28 changed files with 147 additions and 245 deletions
@@ -51,7 +51,7 @@ class CapturedTypeApproximationTest : KotlinTestWithEnvironment() {
fun analyzeTestFile(testType: String) = run {
val test = declarationsText.replace("#TestType#", testType)
val testFile = KtPsiFactory(project).createFile(test)
val bindingContext = JvmResolveUtil.analyzeOneFileWithJavaIntegration(testFile).bindingContext
val bindingContext = JvmResolveUtil.analyze(testFile, environment).bindingContext
val functions = bindingContext.getSliceContents(BindingContext.FUNCTION)
val functionFoo = functions.values.firstOrNull { it.name.asString() == "foo" } ?:
throw AssertionError("Function 'foo' is not declared")