add android bytecode persistence test
This commit is contained in:
committed by
Yan Zhulanow
parent
2643866e31
commit
bf25dffb85
@@ -0,0 +1,7 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.myapp"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0" >
|
||||||
|
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.myapp
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
|
||||||
|
|
||||||
|
class MyActivity: Activity() {
|
||||||
|
val button = this.MyButton
|
||||||
|
}
|
||||||
|
// 1 GETSTATIC
|
||||||
|
// 1 INVOKEVIRTUAL
|
||||||
|
// 1 CHECKCAST
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetailActivity"
|
||||||
|
tools:ignore="MergeRootFrame" >
|
||||||
|
|
||||||
|
<view
|
||||||
|
class="android.widget.Button"
|
||||||
|
android:id="@+id/MyButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign in" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.myapp
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
|
||||||
|
|
||||||
|
class MyActivity: Activity() {
|
||||||
|
val button = this.MyButton
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1 GETSTATIC
|
||||||
|
// 1 INVOKEVIRTUAL
|
||||||
|
// 1 CHECKCAST
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetailActivity"
|
||||||
|
tools:ignore="MergeRootFrame" >
|
||||||
|
|
||||||
|
<android.widget.Button
|
||||||
|
android:id="@+id/MyButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign in" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.myapp
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
|
||||||
|
|
||||||
|
class MyActivity: Activity() {
|
||||||
|
val button = this.login
|
||||||
|
val button1 = this.loginButton
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2 GETSTATIC
|
||||||
|
// 2 INVOKEVIRTUAL
|
||||||
|
// 2 CHECKCAST
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/item_detail_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetailActivity"
|
||||||
|
tools:ignore="MergeRootFrame" >
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Enter your password" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/password"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="textPassword" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign in" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/frameLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetailActivity"
|
||||||
|
tools:ignore="MergeRootFrame" >
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/passwordField"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Enter your password" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/passwordCaption"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="textPassword" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/loginButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign in" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/item_detail_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetailActivity"
|
||||||
|
tools:ignore="MergeRootFrame" >
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Sign in" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.myapp
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Bundle
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
|
public class MyActivity : Activity() {
|
||||||
|
{login}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1 GETSTATIC
|
||||||
|
// 1 INVOKEVIRTUAL
|
||||||
|
// 1 CHECKCAST
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 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.jet.lang.resolve.android
|
||||||
|
|
||||||
|
import org.jetbrains.jet.codegen.AbstractBytecodeTextTest
|
||||||
|
import org.jetbrains.jet.JetTestUtils
|
||||||
|
import org.jetbrains.jet.ConfigurationKind
|
||||||
|
import org.jetbrains.jet.TestJdkKind
|
||||||
|
import org.jetbrains.jet.config.CompilerConfiguration
|
||||||
|
import org.jetbrains.jet.cli.jvm.JVMConfigurationKeys
|
||||||
|
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment
|
||||||
|
|
||||||
|
public abstract class AbstractAndroidBytecodePersistenceTest : AbstractBytecodeTextTest() {
|
||||||
|
|
||||||
|
private fun createAndroidAPIEnvironment(path: String) {
|
||||||
|
return createEnvironmentForConfiguration(JetTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.ANDROID_API), path)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createFakeAndroidEnvironment(path: String) {
|
||||||
|
return createEnvironmentForConfiguration(JetTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK), path)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createEnvironmentForConfiguration(configuration: CompilerConfiguration, path: String) {
|
||||||
|
configuration.put(JVMConfigurationKeys.ANDROID_RES_PATH, path + "res/layout/");
|
||||||
|
configuration.put(JVMConfigurationKeys.ANDROID_MANIFEST, path + "../AndroidManifest.xml");
|
||||||
|
myEnvironment = JetCoreEnvironment.createForTests(getTestRootDisposable()!!, configuration);
|
||||||
|
}
|
||||||
|
public override fun doTest(path: String) {
|
||||||
|
val fileName = path + getTestName(true) + ".kt"
|
||||||
|
createAndroidAPIEnvironment(path)
|
||||||
|
loadFileByFullPath(fileName)
|
||||||
|
val expected = readExpectedOccurrences(fileName)
|
||||||
|
countAndCompareActualOccurrences(expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 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.jet.lang.resolve.android;
|
||||||
|
|
||||||
|
import com.intellij.testFramework.TestDataPath;
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
import org.jetbrains.jet.JetTestUtils;
|
||||||
|
import org.jetbrains.jet.test.InnerTestClasses;
|
||||||
|
import org.jetbrains.jet.test.TestMetadata;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
@TestMetadata("compiler/testData/codegen/androidPersistence")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class AndroidBytecodePersistenceTestGenerated extends AbstractAndroidBytecodePersistenceTest {
|
||||||
|
public void testAllFilesPresentInAndroidPersistence() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/androidPersistence"), Pattern.compile("^([^\\.]+)$"), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fqNameInAttr")
|
||||||
|
public void testFqNameInAttr() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/androidPersistence/fqNameInAttr/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("fqNameInTag")
|
||||||
|
public void testFqNameInTag() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/androidPersistence/fqNameInTag/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("multiFile")
|
||||||
|
public void testMultiFile() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/androidPersistence/multiFile/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("simple")
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/androidPersistence/simple/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -150,6 +150,7 @@ import org.jetbrains.jet.android.AbstractAndroidGotoTest
|
|||||||
import org.jetbrains.jet.jps.build.android.AbstractAndroidJpsTestCase
|
import org.jetbrains.jet.jps.build.android.AbstractAndroidJpsTestCase
|
||||||
import org.jetbrains.jet.android.AbstractAndroidRenameTest
|
import org.jetbrains.jet.android.AbstractAndroidRenameTest
|
||||||
import org.jetbrains.jet.android.AbstractAndroidFindUsagesTest
|
import org.jetbrains.jet.android.AbstractAndroidFindUsagesTest
|
||||||
|
import org.jetbrains.jet.lang.resolve.android.AbstractAndroidBytecodePersistenceTest
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
System.setProperty("java.awt.headless", "true")
|
System.setProperty("java.awt.headless", "true")
|
||||||
@@ -331,6 +332,10 @@ fun main(args: Array<String>) {
|
|||||||
model("codegen/android", recursive = false, extension = null, testMethod = "doCompileAgainstAndroidSdkTest")
|
model("codegen/android", recursive = false, extension = null, testMethod = "doCompileAgainstAndroidSdkTest")
|
||||||
model("codegen/android", recursive = false, extension = null, testMethod = "doFakeInvocationTest", testClassName = "Invoke")
|
model("codegen/android", recursive = false, extension = null, testMethod = "doFakeInvocationTest", testClassName = "Invoke")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testClass(javaClass<AbstractAndroidBytecodePersistenceTest>()) {
|
||||||
|
model("codegen/androidPersistence", recursive = false, extension = null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
testGroup("idea/tests", "idea/testData") {
|
testGroup("idea/tests", "idea/testData") {
|
||||||
|
|||||||
Reference in New Issue
Block a user