Tests: add runtime (and runtime sources) to some tests that rely on being able to resolve references to built ins
This commit is contained in:
+21
-5
@@ -1,3 +1,4 @@
|
|||||||
|
/*
|
||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2015 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
@@ -23,6 +24,7 @@ import com.intellij.openapi.roots.libraries.Library;
|
|||||||
import com.intellij.openapi.util.io.FileUtilRt;
|
import com.intellij.openapi.util.io.FileUtilRt;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.test.MockLibraryUtil;
|
import org.jetbrains.kotlin.test.MockLibraryUtil;
|
||||||
|
import org.jetbrains.kotlin.utils.PathUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -31,31 +33,41 @@ public class JdkAndMockLibraryProjectDescriptor extends KotlinLightProjectDescri
|
|||||||
|
|
||||||
private final String sourcesPath;
|
private final String sourcesPath;
|
||||||
private final boolean withSources;
|
private final boolean withSources;
|
||||||
|
private final boolean withRuntime;
|
||||||
private final boolean isJsLibrary;
|
private final boolean isJsLibrary;
|
||||||
|
|
||||||
public JdkAndMockLibraryProjectDescriptor(String sourcesPath, boolean withSources) {
|
public JdkAndMockLibraryProjectDescriptor(String sourcesPath, boolean withSources) {
|
||||||
this(sourcesPath, withSources, false);
|
this(sourcesPath, withSources, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JdkAndMockLibraryProjectDescriptor(String sourcesPath, boolean withSources, boolean isJsLibrary) {
|
public JdkAndMockLibraryProjectDescriptor(String sourcesPath, boolean withSources, boolean withRuntime, boolean isJsLibrary) {
|
||||||
this.sourcesPath = sourcesPath;
|
this.sourcesPath = sourcesPath;
|
||||||
this.withSources = withSources;
|
this.withSources = withSources;
|
||||||
|
this.withRuntime = withRuntime;
|
||||||
this.isJsLibrary = isJsLibrary;
|
this.isJsLibrary = isJsLibrary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model) {
|
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model) {
|
||||||
File libraryJar = MockLibraryUtil.compileLibraryToJar(sourcesPath, LIBRARY_NAME, withSources, isJsLibrary);
|
File libraryJar = MockLibraryUtil.compileLibraryToJar(sourcesPath, LIBRARY_NAME, withSources, isJsLibrary);
|
||||||
String jarUrl = "jar://" + FileUtilRt.toSystemIndependentName(libraryJar.getAbsolutePath()) + "!/";
|
String jarUrl = getJarUrl(libraryJar);
|
||||||
|
|
||||||
Library.ModifiableModel libraryModel = model.getModuleLibraryTable().getModifiableModel().createLibrary(LIBRARY_NAME).getModifiableModel();
|
Library.ModifiableModel libraryModel = model.getModuleLibraryTable().getModifiableModel().createLibrary(LIBRARY_NAME).getModifiableModel();
|
||||||
libraryModel.addRoot(jarUrl, OrderRootType.CLASSES);
|
libraryModel.addRoot(jarUrl, OrderRootType.CLASSES);
|
||||||
|
if (withRuntime) {
|
||||||
|
libraryModel.addRoot(getJarUrl(PathUtil.getKotlinPathsForDistDirectory().getRuntimePath()), OrderRootType.CLASSES);
|
||||||
|
}
|
||||||
if (withSources) {
|
if (withSources) {
|
||||||
libraryModel.addRoot(jarUrl + "src/", OrderRootType.SOURCES);
|
libraryModel.addRoot(jarUrl + "src/", OrderRootType.SOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
libraryModel.commit();
|
libraryModel.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static String getJarUrl(@NotNull File libraryJar) {
|
||||||
|
return "jar://" + FileUtilRt.toSystemIndependentName(libraryJar.getAbsolutePath()) + "!/";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
@@ -65,15 +77,19 @@ public class JdkAndMockLibraryProjectDescriptor extends KotlinLightProjectDescri
|
|||||||
JdkAndMockLibraryProjectDescriptor that = (JdkAndMockLibraryProjectDescriptor) o;
|
JdkAndMockLibraryProjectDescriptor that = (JdkAndMockLibraryProjectDescriptor) o;
|
||||||
|
|
||||||
if (withSources != that.withSources) return false;
|
if (withSources != that.withSources) return false;
|
||||||
if (sourcesPath != null ? !sourcesPath.equals(that.sourcesPath) : that.sourcesPath != null) return false;
|
if (withRuntime != that.withRuntime) return false;
|
||||||
|
if (isJsLibrary != that.isJsLibrary) return false;
|
||||||
|
if (!sourcesPath.equals(that.sourcesPath)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = sourcesPath != null ? sourcesPath.hashCode() : 0;
|
int result = sourcesPath.hashCode();
|
||||||
result = 31 * result + (withSources ? 1 : 0);
|
result = 31 * result + (withSources ? 1 : 0);
|
||||||
|
result = 31 * result + (withRuntime ? 1 : 0);
|
||||||
|
result = 31 * result + (isJsLibrary ? 1 : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
@@ -2,6 +2,7 @@
|
|||||||
// ACTION: Create extension function 'Foo'
|
// ACTION: Create extension function 'Foo'
|
||||||
// ACTION: Rename reference
|
// ACTION: Rename reference
|
||||||
// ERROR: Unresolved reference: Foo
|
// ERROR: Unresolved reference: Foo
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val a = 2.<caret>Foo(1)
|
val a = 2.<caret>Foo(1)
|
||||||
|
|||||||
Vendored
+1
@@ -2,6 +2,7 @@
|
|||||||
// ACTION: Create extension function 'Foo'
|
// ACTION: Create extension function 'Foo'
|
||||||
// ACTION: Rename reference
|
// ACTION: Rename reference
|
||||||
// ERROR: Unresolved reference: Foo
|
// ERROR: Unresolved reference: Foo
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val items: List<T>) {
|
class A<T>(val items: List<T>) {
|
||||||
fun test() = items.<caret>Foo<Int, String>(2, "2")
|
fun test() = items.<caret>Foo<Int, String>(2, "2")
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'plus'" "true"
|
// "Create extension function 'plus'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'plus'" "true"
|
// "Create extension function 'plus'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function '!u00A0'" "true"
|
// "Create extension function '!u00A0'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val t: Int = 1 <caret>`!u00A0` 2
|
val t: Int = 1 <caret>`!u00A0` 2
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function '!u00A0'" "true"
|
// "Create extension function '!u00A0'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val t: Int = 1 `!u00A0` 2
|
val t: Int = 1 `!u00A0` 2
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val a: Int = Unit.<caret>foo(2)
|
val a: Int = Unit.<caret>foo(2)
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val a: Int = Unit.foo(2)
|
val a: Int = Unit.foo(2)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val items: List<T>) {
|
class A<T>(val items: List<T>) {
|
||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
|
|||||||
Vendored
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val items: List<T>) {
|
class A<T>(val items: List<T>) {
|
||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val items: List<T>) {
|
class A<T>(val items: List<T>) {
|
||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val items: List<T>) {
|
class A<T>(val items: List<T>) {
|
||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
|
|||||||
idea/testData/quickfix/createFromUsage/createFunction/call/typeArguments/extensionWithReceiverArg.kt
Vendored
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val items: List<T>) {
|
class A<T>(val items: List<T>) {
|
||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val items: List<T>) {
|
class A<T>(val items: List<T>) {
|
||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
fun <T, U> T.map(f: T.() -> U) = f()
|
fun <T, U> T.map(f: T.() -> U) = f()
|
||||||
|
|
||||||
fun consume(s: String) {}
|
fun consume(s: String) {}
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'foo'" "true"
|
// "Create extension function 'foo'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
fun <T, U> T.map(f: T.() -> U) = f()
|
fun <T, U> T.map(f: T.() -> U) = f()
|
||||||
|
|
||||||
fun consume(s: String) {}
|
fun consume(s: String) {}
|
||||||
|
|||||||
Vendored
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'component2'" "true"
|
// "Create extension function 'component2'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
class FooIterator<T> {
|
class FooIterator<T> {
|
||||||
operator fun hasNext(): Boolean { return false }
|
operator fun hasNext(): Boolean { return false }
|
||||||
operator fun next(): Any {
|
operator fun next(): Any {
|
||||||
|
|||||||
Vendored
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'component2'" "true"
|
// "Create extension function 'component2'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
class FooIterator<T> {
|
class FooIterator<T> {
|
||||||
operator fun hasNext(): Boolean { return false }
|
operator fun hasNext(): Boolean { return false }
|
||||||
operator fun next(): Any {
|
operator fun next(): Any {
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'get'" "true"
|
// "Create extension function 'get'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun x (y: Any) {
|
fun x (y: Any) {
|
||||||
val z: Any = y<caret>[""]
|
val z: Any = y<caret>[""]
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'get'" "true"
|
// "Create extension function 'get'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun x (y: Any) {
|
fun x (y: Any) {
|
||||||
val z: Any = y[""]
|
val z: Any = y[""]
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'invoke'" "true"
|
// "Create extension function 'invoke'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'invoke'" "true"
|
// "Create extension function 'invoke'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'set'" "true"
|
// "Create extension function 'set'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class Foo<T> {
|
class Foo<T> {
|
||||||
fun <T> x (y: Any, w: java.util.ArrayList<T>) {
|
fun <T> x (y: Any, w: java.util.ArrayList<T>) {
|
||||||
|
|||||||
+1
@@ -1,6 +1,7 @@
|
|||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
// "Create extension function 'set'" "true"
|
// "Create extension function 'set'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class Foo<T> {
|
class Foo<T> {
|
||||||
fun <T> x (y: Any, w: java.util.ArrayList<T>) {
|
fun <T> x (y: Any, w: java.util.ArrayList<T>) {
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'unaryMinus'" "true"
|
// "Create extension function 'unaryMinus'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val a = <caret>-false
|
val a = <caret>-false
|
||||||
|
|||||||
Vendored
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create extension function 'unaryMinus'" "true"
|
// "Create extension function 'unaryMinus'" "true"
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val a = -false
|
val a = -false
|
||||||
|
|||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
// "Create secondary constructor" "false"
|
// "Create secondary constructor" "false"
|
||||||
// ERROR: Too many arguments for public constructor Any() defined in kotlin.Any
|
// ERROR: Too many arguments for public constructor Any() defined in kotlin.Any
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
interface T {
|
interface T {
|
||||||
|
|
||||||
|
|||||||
+1
@@ -2,6 +2,7 @@
|
|||||||
// ERROR: Unresolved reference: foo
|
// ERROR: Unresolved reference: foo
|
||||||
// ACTION: Create extension function 'foo'
|
// ACTION: Create extension function 'foo'
|
||||||
// ACTION: Replace infix call with ordinary call
|
// ACTION: Replace infix call with ordinary call
|
||||||
|
// WITH_RUNTIME
|
||||||
fun refer() {
|
fun refer() {
|
||||||
1 <caret>foo 2
|
1 <caret>foo 2
|
||||||
}
|
}
|
||||||
+1
@@ -2,6 +2,7 @@
|
|||||||
// ERROR: Unresolved reference: foo
|
// ERROR: Unresolved reference: foo
|
||||||
// ACTION: Create extension function 'foo'
|
// ACTION: Create extension function 'foo'
|
||||||
// ACTION: Replace infix call with ordinary call
|
// ACTION: Replace infix call with ordinary call
|
||||||
|
// WITH_RUNTIME
|
||||||
fun refer() {
|
fun refer() {
|
||||||
1 <caret>foo 2
|
1 <caret>foo 2
|
||||||
}
|
}
|
||||||
+1
@@ -2,6 +2,7 @@
|
|||||||
// ACTION: Create extension property 'foo'
|
// ACTION: Create extension property 'foo'
|
||||||
// ACTION: Rename reference
|
// ACTION: Rename reference
|
||||||
// ERROR: Unresolved reference: foo
|
// ERROR: Unresolved reference: foo
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -2,6 +2,7 @@
|
|||||||
// ERROR: Unresolved reference: foo
|
// ERROR: Unresolved reference: foo
|
||||||
// ACTION: Create extension function 'foo'
|
// ACTION: Create extension function 'foo'
|
||||||
// ACTION: Replace infix call with ordinary call
|
// ACTION: Replace infix call with ordinary call
|
||||||
|
// WITH_RUNTIME
|
||||||
fun refer() {
|
fun refer() {
|
||||||
1 <caret>foo 2
|
1 <caret>foo 2
|
||||||
}
|
}
|
||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
// "Create extension property 'foo'" "true"
|
// "Create extension property 'foo'" "true"
|
||||||
// ERROR: Property must be initialized
|
// ERROR: Property must be initialized
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val a: Int = Unit.<caret>foo
|
val a: Int = Unit.<caret>foo
|
||||||
|
|||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
// "Create extension property 'foo'" "true"
|
// "Create extension property 'foo'" "true"
|
||||||
// ERROR: Property must be initialized
|
// ERROR: Property must be initialized
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
val Unit.foo: Int
|
val Unit.foo: Int
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
// "Create extension property 'foo'" "true"
|
// "Create extension property 'foo'" "true"
|
||||||
// ERROR: Property must be initialized
|
// ERROR: Property must be initialized
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
// "Create extension property 'foo'" "true"
|
// "Create extension property 'foo'" "true"
|
||||||
// ERROR: Property must be initialized
|
// ERROR: Property must be initialized
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
// "Create extension property 'foo'" "true"
|
// "Create extension property 'foo'" "true"
|
||||||
// ERROR: Property must be initialized
|
// ERROR: Property must be initialized
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
// "Create extension property 'foo'" "true"
|
// "Create extension property 'foo'" "true"
|
||||||
// ERROR: Property must be initialized
|
// ERROR: Property must be initialized
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
class A<T>(val n: T)
|
class A<T>(val n: T)
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
@@ -1,5 +1,6 @@
|
|||||||
// PARAM_DESCRIPTOR: public fun Bar.foo(): kotlin.Unit defined in root package
|
// PARAM_DESCRIPTOR: public fun Bar.foo(): kotlin.Unit defined in root package
|
||||||
// PARAM_TYPES: Bar, Foo, kotlin.Any
|
// PARAM_TYPES: Bar, Foo, kotlin.Any
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
open class Foo
|
open class Foo
|
||||||
class Bar : Foo()
|
class Bar : Foo()
|
||||||
|
|||||||
Vendored
+1
@@ -1,5 +1,6 @@
|
|||||||
// PARAM_DESCRIPTOR: public fun Bar.foo(): kotlin.Unit defined in root package
|
// PARAM_DESCRIPTOR: public fun Bar.foo(): kotlin.Unit defined in root package
|
||||||
// PARAM_TYPES: Bar, Foo, kotlin.Any
|
// PARAM_TYPES: Bar, Foo, kotlin.Any
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
open class Foo
|
open class Foo
|
||||||
class Bar : Foo()
|
class Bar : Foo()
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
val a: <caret>Number? = null
|
val a: <caret>Number? = null
|
||||||
|
|
||||||
// CONTEXT: public abstract fun toDouble(): <ref-caret>Double
|
// CONTEXT: public abstract fun toDouble(): <ref-caret>Double
|
||||||
// RUNTIME
|
// RUNTIME_WITH_SOURCES
|
||||||
|
|
||||||
// REF: (kotlin).Double
|
// REF: (kotlin).Double
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea;
|
|||||||
|
|
||||||
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
|
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
|
||||||
import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestBase;
|
import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestBase;
|
||||||
|
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
|
|
||||||
public abstract class KotlinHierarchyViewTestBase extends HierarchyViewTestBase {
|
public abstract class KotlinHierarchyViewTestBase extends HierarchyViewTestBase {
|
||||||
@@ -25,10 +26,12 @@ public abstract class KotlinHierarchyViewTestBase extends HierarchyViewTestBase
|
|||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory());
|
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory());
|
||||||
|
ConfigLibraryUtil.configureKotlinRuntime(myModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
|
ConfigLibraryUtil.unConfigureKotlinRuntime(myModule);
|
||||||
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory());
|
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory());
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -73,7 +73,7 @@ public class NavigateFromLibrarySourcesTest: LightCodeInsightFixtureTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getProjectDescriptor(): LightProjectDescriptor {
|
override fun getProjectDescriptor(): LightProjectDescriptor {
|
||||||
return JdkAndMockLibraryProjectDescriptor(PluginTestCaseBase.getTestDataPathBase() + "/decompiler/navigation/fromLibSource", true)
|
return JdkAndMockLibraryProjectDescriptor(PluginTestCaseBase.getTestDataPathBase() + "/decompiler/navigation/fromLibSource", true, true, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkNavigationElement(element: PsiElement, expectedFqName: String) {
|
private fun checkNavigationElement(element: PsiElement, expectedFqName: String) {
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ public abstract class AbstractDecompiledTextBaseTest(
|
|||||||
if (isAllFilesPresentInTest()) {
|
if (isAllFilesPresentInTest()) {
|
||||||
return KotlinLightProjectDescriptor.INSTANCE
|
return KotlinLightProjectDescriptor.INSTANCE
|
||||||
}
|
}
|
||||||
return JdkAndMockLibraryProjectDescriptor(TEST_DATA_PATH + "/" + getTestName(false), false, isJsLibrary)
|
return JdkAndMockLibraryProjectDescriptor(TEST_DATA_PATH + "/" + getTestName(false), false, false, isJsLibrary)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkThatFileWasParsedCorrectly(clsFile: PsiFile) {
|
private fun checkThatFileWasParsedCorrectly(clsFile: PsiFile) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.asJava.KtLightClass;
|
|||||||
import org.jetbrains.kotlin.asJava.KtLightMethod;
|
import org.jetbrains.kotlin.asJava.KtLightMethod;
|
||||||
import org.jetbrains.kotlin.asJava.LightClassUtil;
|
import org.jetbrains.kotlin.asJava.LightClassUtil;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase;
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase;
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor;
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor;
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
||||||
import org.jetbrains.kotlin.name.SpecialNames;
|
import org.jetbrains.kotlin.name.SpecialNames;
|
||||||
import org.jetbrains.kotlin.psi.*;
|
import org.jetbrains.kotlin.psi.*;
|
||||||
@@ -34,7 +34,7 @@ public class KotlinJavaFacadeTest extends KotlinLightCodeInsightFixtureTestCase
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
protected LightProjectDescriptor getProjectDescriptor() {
|
protected LightProjectDescriptor getProjectDescriptor() {
|
||||||
return KotlinLightProjectDescriptor.INSTANCE;
|
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import kotlin.CollectionsKt;
|
|||||||
import kotlin.StringsKt;
|
import kotlin.StringsKt;
|
||||||
import kotlin.jvm.functions.Function1;
|
import kotlin.jvm.functions.Function1;
|
||||||
import org.apache.commons.lang.SystemUtils;
|
import org.apache.commons.lang.SystemUtils;
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.idea.KotlinLightQuickFixTestCase;
|
import org.jetbrains.kotlin.idea.KotlinLightQuickFixTestCase;
|
||||||
@@ -167,23 +166,25 @@ public abstract class AbstractQuickFixTest extends KotlinLightQuickFixTestCase {
|
|||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
private static void configureRuntimeIfNeeded(@NotNull String beforeFileName) {
|
private static void configureRuntimeIfNeeded(@NotNull String beforeFileName) throws IOException {
|
||||||
if (beforeFileName.endsWith("JsRuntime.kt")) {
|
if (beforeFileName.endsWith("JsRuntime.kt")) {
|
||||||
// Without the following line of code subsequent tests with js-runtime will be prone to failure due "outdated stub in index" error.
|
// Without the following line of code subsequent tests with js-runtime will be prone to failure due "outdated stub in index" error.
|
||||||
FileBasedIndex.getInstance().requestRebuild(StubUpdatingIndex.INDEX_ID);
|
FileBasedIndex.getInstance().requestRebuild(StubUpdatingIndex.INDEX_ID);
|
||||||
|
|
||||||
ConfigLibraryUtil.configureKotlinJsRuntimeAndSdk(getModule(), getFullJavaJDK());
|
ConfigLibraryUtil.configureKotlinJsRuntimeAndSdk(getModule(), getFullJavaJDK());
|
||||||
}
|
}
|
||||||
else if (beforeFileName.endsWith("Runtime.kt")) {
|
else if (beforeFileName.endsWith("Runtime.kt") ||
|
||||||
|
InTextDirectivesUtils.isDirectiveDefined(FileUtil.loadFile(new File(beforeFileName)), "WITH_RUNTIME")) {
|
||||||
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(getModule(), getFullJavaJDK());
|
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(getModule(), getFullJavaJDK());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unConfigureRuntimeIfNeeded(@NotNull String beforeFileName) {
|
private void unConfigureRuntimeIfNeeded(@NotNull String beforeFileName) throws IOException {
|
||||||
if (beforeFileName.endsWith("JsRuntime.kt")) {
|
if (beforeFileName.endsWith("JsRuntime.kt")) {
|
||||||
ConfigLibraryUtil.unConfigureKotlinJsRuntimeAndSdk(getModule(), getProjectJDK());
|
ConfigLibraryUtil.unConfigureKotlinJsRuntimeAndSdk(getModule(), getProjectJDK());
|
||||||
}
|
}
|
||||||
else if (beforeFileName.endsWith("Runtime.kt")) {
|
else if (beforeFileName.endsWith("Runtime.kt") ||
|
||||||
|
InTextDirectivesUtils.isDirectiveDefined(FileUtil.loadFile(new File(beforeFileName)), "WITH_RUNTIME")) {
|
||||||
ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(getModule(), getProjectJDK());
|
ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(getModule(), getProjectJDK());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -28,6 +28,6 @@ public abstract class AbstractReferenceResolveWithLibTest extends AbstractRefere
|
|||||||
if (PluginTestCaseBase.isAllFilesPresentTest(getTestName(true))) {
|
if (PluginTestCaseBase.isAllFilesPresentTest(getTestName(true))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new JdkAndMockLibraryProjectDescriptor(TEST_DATA_PATH + "/" + getTestName(true) + "Src", false);
|
return new JdkAndMockLibraryProjectDescriptor(TEST_DATA_PATH + "/" + getTestName(true) + "Src", false, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,11 +28,15 @@ import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider
|
|||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import com.intellij.openapi.ui.Queryable.PrintInfo
|
import com.intellij.openapi.ui.Queryable.PrintInfo
|
||||||
|
import com.intellij.testFramework.LightProjectDescriptor
|
||||||
|
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||||
import org.jetbrains.kotlin.test.util.configureWithExtraFile
|
import org.jetbrains.kotlin.test.util.configureWithExtraFile
|
||||||
|
|
||||||
public abstract class AbstractKotlinFileStructureTest : KotlinLightCodeInsightFixtureTestCase() {
|
public abstract class AbstractKotlinFileStructureTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/structureView/fileStructure"
|
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/structureView/fileStructure"
|
||||||
|
|
||||||
|
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
|
|
||||||
public fun doTest(path: String) {
|
public fun doTest(path: String) {
|
||||||
myFixture.configureWithExtraFile(path)
|
myFixture.configureWithExtraFile(path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user