Extract plugins tests to separate module with JDK 1.8
This commit is contained in:
@@ -14,8 +14,5 @@
|
||||
<orderEntry type="module" module-name="util" />
|
||||
<orderEntry type="library" name="intellij-core" level="project" />
|
||||
<orderEntry type="module" module-name="backend" scope="PROVIDED" />
|
||||
<orderEntry type="library" scope="TEST" name="jps-test" level="project" />
|
||||
<orderEntry type="module" module-name="compiler-tests" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="idea-full" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.lang.resolve.android.test
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.util.ArrayUtil
|
||||
import com.intellij.util.Processor
|
||||
import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTest
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestFiles
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import java.util.regex.Pattern
|
||||
|
||||
abstract class AbstractAndroidBoxTest : AbstractBlackBoxCodegenTest() {
|
||||
|
||||
private fun createAndroidAPIEnvironment(path: String) {
|
||||
return createEnvironmentForConfiguration(KotlinTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.ANDROID_API), path)
|
||||
}
|
||||
|
||||
private fun createFakeAndroidEnvironment(path: String) {
|
||||
return createEnvironmentForConfiguration(KotlinTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK), path)
|
||||
}
|
||||
|
||||
private fun createEnvironmentForConfiguration(configuration: CompilerConfiguration, path: String) {
|
||||
val layoutPaths = File(path).listFiles { it -> it.name.startsWith("layout") && it.isDirectory }!!.map { "$path${it.name}/" }
|
||||
myEnvironment = createAndroidTestEnvironment(configuration, layoutPaths)
|
||||
}
|
||||
|
||||
fun doCompileAgainstAndroidSdkTest(path: String) {
|
||||
createAndroidAPIEnvironment(path)
|
||||
doMultiFileTest(path)
|
||||
}
|
||||
|
||||
fun doFakeInvocationTest(path: String) {
|
||||
if (needsInvocationTest(path)) {
|
||||
createFakeAndroidEnvironment(path)
|
||||
doMultiFileTest(path, getFakeFiles(path))
|
||||
}
|
||||
}
|
||||
|
||||
private fun getFakeFiles(path: String): Collection<String> {
|
||||
return FileUtil.findFilesByMask(Pattern.compile("^Fake.*\\.kt$"), File(path.replace(getTestName(true), ""))).map { relativePath(it) }
|
||||
}
|
||||
|
||||
private fun needsInvocationTest(path: String): Boolean {
|
||||
return !FileUtil.findFilesByMask(Pattern.compile("^0.kt$"), File(path)).isEmpty()
|
||||
}
|
||||
|
||||
override fun codegenTestBasePath(): String {
|
||||
return "plugins/android-extensions/android-extensions-compiler/testData/codegen/"
|
||||
}
|
||||
|
||||
private fun doMultiFileTest(path: String, additionalFiles: Collection<String>? = null) {
|
||||
val files = ArrayList<String>(2)
|
||||
FileUtil.processFilesRecursively(File(path), object : Processor<File> {
|
||||
override fun process(file: File?): Boolean {
|
||||
when (file!!.name) {
|
||||
"1.kt" -> {
|
||||
if (additionalFiles == null) files.add(relativePath(file))
|
||||
}
|
||||
"0.kt" -> {
|
||||
if (additionalFiles != null) files.add(relativePath(file))
|
||||
}
|
||||
else -> {
|
||||
if (file.name.endsWith(".kt")) files.add(relativePath(file))
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
})
|
||||
Collections.sort(files);
|
||||
if (additionalFiles != null) {
|
||||
files.addAll(additionalFiles)
|
||||
}
|
||||
myFiles = CodegenTestFiles.create(
|
||||
myEnvironment!!.project,
|
||||
ArrayUtil.toStringArray(files),
|
||||
KotlinTestUtils.getHomeDirectory() + "/plugins/android-extensions/android-extensions-compiler/testData"
|
||||
)
|
||||
blackBox();
|
||||
}
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.lang.resolve.android.test
|
||||
|
||||
import org.jetbrains.kotlin.codegen.AbstractBytecodeTextTest
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
|
||||
abstract class AbstractAndroidBytecodeShapeTest : AbstractBytecodeTextTest() {
|
||||
|
||||
private fun createAndroidAPIEnvironment(path: String) {
|
||||
return createEnvironmentForConfiguration(KotlinTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.ANDROID_API), path)
|
||||
}
|
||||
|
||||
private fun createEnvironmentForConfiguration(configuration: CompilerConfiguration, path: String) {
|
||||
val layoutPaths = getResPaths(path)
|
||||
myEnvironment = createAndroidTestEnvironment(configuration, layoutPaths)
|
||||
}
|
||||
|
||||
override fun doTest(path: String) {
|
||||
val fileName = path + getTestName(true) + ".kt"
|
||||
createAndroidAPIEnvironment(path)
|
||||
loadFileByFullPath(fileName)
|
||||
val expected = readExpectedOccurrences(fileName)
|
||||
val actual = generateToText()
|
||||
checkGeneratedTextAgainstExpectedOccurrences(actual, expected)
|
||||
}
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.lang.resolve.android.test
|
||||
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidPackageFragmentProviderExtension
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidSyntheticPackageFragmentProvider
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractAndroidSyntheticPropertyDescriptorTest : UsefulTestCase() {
|
||||
|
||||
fun doTest(path: String) {
|
||||
val config = KotlinTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.ANDROID_API)
|
||||
val env = createAndroidTestEnvironment(config, getResPaths(path))
|
||||
val project = env.project
|
||||
|
||||
val ext = PackageFragmentProviderExtension.getInstances(project).first { it is AndroidPackageFragmentProviderExtension }
|
||||
|
||||
val analysisResult = JvmResolveUtil.analyzeFilesWithJavaIntegrationAndCheckForErrors(project, listOf(), JvmPackagePartProvider(env))
|
||||
|
||||
val fragmentProvider = ext.getPackageFragmentProvider(project, analysisResult.moduleDescriptor, LockBasedStorageManager.NO_LOCKS,
|
||||
KotlinTestUtils.DUMMY_EXCEPTION_ON_ERROR_TRACE, null) as AndroidSyntheticPackageFragmentProvider
|
||||
|
||||
val renderer = DescriptorRenderer.COMPACT_WITH_MODIFIERS
|
||||
val expected = fragmentProvider.packageFragments.sortedBy { it.fqName.asString() }.map {
|
||||
val descriptors = it.getMemberScope().getContributedDescriptors()
|
||||
.sortedWith(MemberComparator.INSTANCE)
|
||||
.map { " " + renderer.render(it) }.joinToString("\n")
|
||||
it.fqName.asString() + (if (descriptors.isNotEmpty()) "\n\n" + descriptors else "")
|
||||
}.joinToString("\n\n\n")
|
||||
|
||||
KotlinTestUtils.assertEqualsToFile(File(path, "result.txt"), expected)
|
||||
}
|
||||
}
|
||||
-133
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.lang.resolve.android.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class AndroidBoxTestGenerated extends AbstractAndroidBoxTest {
|
||||
@TestMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Android extends AbstractAndroidBoxTest {
|
||||
public void testAllFilesPresentInAndroid() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("plugins/android-extensions/android-extensions-compiler/testData/codegen/android"), Pattern.compile("^([^\\.]+)$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInAttr")
|
||||
public void testFqNameInAttr() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/fqNameInAttr/");
|
||||
doCompileAgainstAndroidSdkTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInTag")
|
||||
public void testFqNameInTag() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/fqNameInTag/");
|
||||
doCompileAgainstAndroidSdkTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fragment")
|
||||
public void testFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/fragment/");
|
||||
doCompileAgainstAndroidSdkTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("manyWidgets")
|
||||
public void testManyWidgets() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/manyWidgets/");
|
||||
doCompileAgainstAndroidSdkTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiFile")
|
||||
public void testMultiFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/multiFile/");
|
||||
doCompileAgainstAndroidSdkTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("singleFile")
|
||||
public void testSingleFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/singleFile/");
|
||||
doCompileAgainstAndroidSdkTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("view")
|
||||
public void testView() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/view/");
|
||||
doCompileAgainstAndroidSdkTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Invoke extends AbstractAndroidBoxTest {
|
||||
public void testAllFilesPresentInInvoke() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("plugins/android-extensions/android-extensions-compiler/testData/codegen/android"), Pattern.compile("^([^\\.]+)$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInAttr")
|
||||
public void testFqNameInAttr() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/fqNameInAttr/");
|
||||
doFakeInvocationTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInTag")
|
||||
public void testFqNameInTag() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/fqNameInTag/");
|
||||
doFakeInvocationTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fragment")
|
||||
public void testFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/fragment/");
|
||||
doFakeInvocationTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("manyWidgets")
|
||||
public void testManyWidgets() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/manyWidgets/");
|
||||
doFakeInvocationTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiFile")
|
||||
public void testMultiFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/multiFile/");
|
||||
doFakeInvocationTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("singleFile")
|
||||
public void testSingleFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/singleFile/");
|
||||
doFakeInvocationTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("view")
|
||||
public void testView() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/android/view/");
|
||||
doFakeInvocationTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
-169
@@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.lang.resolve.android.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class AndroidBytecodeShapeTestGenerated extends AbstractAndroidBytecodeShapeTest {
|
||||
public void testAllFilesPresentInBytecodeShape() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape"), Pattern.compile("^([^\\.]+)$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("baseClass")
|
||||
public void testBaseClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/baseClass/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("baseClassFragment")
|
||||
public void testBaseClassFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/baseClassFragment/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("clearCache")
|
||||
public void testClearCache() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/clearCache/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("clearCacheBaseClass")
|
||||
public void testClearCacheBaseClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/clearCacheBaseClass/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunctions")
|
||||
public void testExtensionFunctions() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/extensionFunctions/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunctionsFragment")
|
||||
public void testExtensionFunctionsFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/extensionFunctionsFragment/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunctionsView")
|
||||
public void testExtensionFunctionsView() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/extensionFunctionsView/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInAttr")
|
||||
public void testFqNameInAttr() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/fqNameInAttr/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInAttrFragment")
|
||||
public void testFqNameInAttrFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/fqNameInAttrFragment/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInTag")
|
||||
public void testFqNameInTag() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/fqNameInTag/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInTagFragment")
|
||||
public void testFqNameInTagFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/fqNameInTagFragment/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiFile")
|
||||
public void testMultiFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/multiFile/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiFileFragment")
|
||||
public void testMultiFileFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/multiFileFragment/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("onDestroyFragment")
|
||||
public void testOnDestroyFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/onDestroyFragment/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/simple/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleFragment")
|
||||
public void testSimpleFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/simpleFragment/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleFragmentProperty")
|
||||
public void testSimpleFragmentProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/simpleFragmentProperty/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleView")
|
||||
public void testSimpleView() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/simpleView/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("supportExtensionFunctionsFragment")
|
||||
public void testSupportExtensionFunctionsFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/supportExtensionFunctionsFragment/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("supportSimpleFragment")
|
||||
public void testSupportSimpleFragment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/supportSimpleFragment/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("supportSimpleFragmentProperty")
|
||||
public void testSupportSimpleFragmentProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/supportSimpleFragmentProperty/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("viewStub")
|
||||
public void testViewStub() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/codegen/bytecodeShape/viewStub/");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
-127
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.lang.resolve.android.test;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class AndroidSyntheticPropertyDescriptorTestGenerated extends AbstractAndroidSyntheticPropertyDescriptorTest {
|
||||
public void testAllFilesPresentInDescriptors() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("plugins/android-extensions/android-extensions-compiler/testData/descriptors"), Pattern.compile("^([^\\.]+)$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("escapedLayoutName")
|
||||
public void testEscapedLayoutName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/escapedLayoutName/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInAttr")
|
||||
public void testFqNameInAttr() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/fqNameInAttr/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fqNameInTag")
|
||||
public void testFqNameInTag() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/fqNameInTag/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("layoutVariants")
|
||||
public void testLayoutVariants() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/layoutVariants/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiFile")
|
||||
public void testMultiFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/multiFile/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noIds")
|
||||
public void testNoIds() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/noIds/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("sameIds")
|
||||
public void testSameIds() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/sameIds/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("severalResDirs")
|
||||
public void testSeveralResDirs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/severalResDirs/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("singleFile")
|
||||
public void testSingleFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/singleFile/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("specialTags")
|
||||
public void testSpecialTags() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/specialTags/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("supportSingleFile")
|
||||
public void testSupportSingleFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/supportSingleFile/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("supportSpecialTags")
|
||||
public void testSupportSpecialTags() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/supportSpecialTags/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unresolvedFqName")
|
||||
public void testUnresolvedFqName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/unresolvedFqName/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unresolvedWidget")
|
||||
public void testUnresolvedWidget() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/unresolvedWidget/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("viewStub")
|
||||
public void testViewStub() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-compiler/testData/descriptors/viewStub/");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.lang.resolve.android.test
|
||||
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import com.intellij.testFramework.registerServiceInstance
|
||||
import org.jetbrains.kotlin.android.synthetic.AndroidConfigurationKeys
|
||||
import org.jetbrains.kotlin.android.synthetic.AndroidExtensionPropertiesComponentContainerContributor
|
||||
import org.jetbrains.kotlin.android.synthetic.codegen.AndroidExpressionCodegenExtension
|
||||
import org.jetbrains.kotlin.android.synthetic.codegen.AndroidOnDestroyClassBuilderInterceptorExtension
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidLayoutXmlFileManager
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidVariant
|
||||
import org.jetbrains.kotlin.android.synthetic.res.CliAndroidLayoutXmlFileManager
|
||||
import org.jetbrains.kotlin.android.synthetic.res.CliAndroidPackageFragmentProviderExtension
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension
|
||||
import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension
|
||||
import java.io.File
|
||||
|
||||
fun UsefulTestCase.createAndroidTestEnvironment(configuration: CompilerConfiguration, resDirectories: List<String>): KotlinCoreEnvironment {
|
||||
configuration.put(AndroidConfigurationKeys.VARIANT, resDirectories)
|
||||
configuration.put(AndroidConfigurationKeys.PACKAGE, "test")
|
||||
|
||||
val myEnvironment = KotlinCoreEnvironment.createForTests(testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
|
||||
val project = myEnvironment.project
|
||||
|
||||
val variants = listOf(AndroidVariant.createMainVariant(resDirectories))
|
||||
project.registerServiceInstance(AndroidLayoutXmlFileManager::class.java, CliAndroidLayoutXmlFileManager(project, "test", variants))
|
||||
|
||||
ExpressionCodegenExtension.registerExtension(project, AndroidExpressionCodegenExtension())
|
||||
StorageComponentContainerContributor.registerExtension(project, AndroidExtensionPropertiesComponentContainerContributor())
|
||||
ClassBuilderInterceptorExtension.registerExtension(project, AndroidOnDestroyClassBuilderInterceptorExtension())
|
||||
PackageFragmentProviderExtension.registerExtension(project, CliAndroidPackageFragmentProviderExtension())
|
||||
|
||||
return myEnvironment
|
||||
}
|
||||
|
||||
fun getResPaths(path: String): List<String> {
|
||||
return File(path).listFiles { it -> it.name.startsWith("res") && it.isDirectory }!!.map { "$path${it.name}/" }
|
||||
}
|
||||
Reference in New Issue
Block a user