Refactor debugger tests
1. Move tests to their own module 2. Avoid sharing the 'tinyApp' project between tests 3. Clean up option directive handling
This commit is contained in:
-8
@@ -1,8 +0,0 @@
|
||||
@file:JvmName("SameNameBreakpointOnLocalProperty")
|
||||
@file:JvmMultifileClass
|
||||
package customLib.breakpointOnLocalProperty
|
||||
|
||||
public fun breakpointOnLocalPropertyFun(): Int {
|
||||
val a = 1
|
||||
return 1
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
@file:JvmName("SameNameBreakpointOnLocalProperty")
|
||||
@file:JvmMultifileClass
|
||||
package customLib.breakpointOnLocalProperty
|
||||
|
||||
public fun breakpointOnLocalPropertyFun2(): Int {
|
||||
return 1
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
package delegatedPropertyInOtherFileOther
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class WithDelegate {
|
||||
val a: Int by Id(12)
|
||||
}
|
||||
|
||||
class Id(val v: Int) {
|
||||
operator fun getValue(o: Any, property: KProperty<*>): Int = v
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package fileWithInternal
|
||||
|
||||
fun test() {
|
||||
// Breakpoint
|
||||
val a = fileWithInternal2.MyInternal()
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
package fileWithInternal2
|
||||
|
||||
internal class MyInternal
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
package customLib.functionInLibrary
|
||||
|
||||
public inline fun simpleFun2() {
|
||||
val a = 1
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package customLib.functionInLibrary
|
||||
|
||||
public inline fun simpleFun() {
|
||||
nextFun()
|
||||
}
|
||||
|
||||
public inline fun nextFun() {
|
||||
val a = 1
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package customLib.inlineFunInLibrary
|
||||
|
||||
public inline fun inlineFun(f: () -> Unit) {
|
||||
1 + 1
|
||||
inlineFunInner {
|
||||
1 + 1
|
||||
}
|
||||
}
|
||||
|
||||
public inline fun inlineFunInner(f: () -> Unit) {
|
||||
// Breakpoint 2
|
||||
1 + 1
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package isInsideInlineLambdaInLibrary
|
||||
|
||||
public fun test() {
|
||||
val a = A()
|
||||
//Breakpoint1
|
||||
a.foo(1) { 1 }
|
||||
|
||||
// inside other lambda
|
||||
a.foo(100) {
|
||||
//Breakpoint2
|
||||
a.foo(2) { 1 }
|
||||
1
|
||||
}
|
||||
|
||||
// inside variable declaration
|
||||
//Breakpoint3
|
||||
val x = a.foo(3) { 1 }
|
||||
|
||||
// inside object declaration
|
||||
val y = object {
|
||||
fun foo() {
|
||||
//Breakpoint4
|
||||
a.foo(4) { 1 }
|
||||
}
|
||||
}
|
||||
y.foo()
|
||||
|
||||
// inside local function
|
||||
fun local() {
|
||||
//Breakpoint5
|
||||
a.foo(5) { 1 }
|
||||
}
|
||||
local()
|
||||
}
|
||||
|
||||
class A {
|
||||
inline fun foo(i: Int, f: (i: Int) -> Int): A {
|
||||
f(i)
|
||||
return this
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
package customLib.localFunInLibraryCustomLib
|
||||
|
||||
public fun localFunInLibraryCustomLibMainFun() {
|
||||
fun localFun() = 1
|
||||
val localFunInLibraryCustomLibProperty = 1
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
@file:JvmName("SameNameOneFunSameFileName")
|
||||
@file:JvmMultifileClass
|
||||
package customLib.oneFunSameClassName
|
||||
|
||||
public fun oneFunSameFileNameFun(): Int {
|
||||
return 1
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
@file:JvmName("SameNameOneFunSameFileName")
|
||||
@file:JvmMultifileClass
|
||||
package customLib.oneFunSameClassName
|
||||
|
||||
public fun oneFunSameFileNameFun2(): Int {
|
||||
return 1
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
@file:JvmName("SameNameProperty")
|
||||
@file:JvmMultifileClass
|
||||
package customLib.property
|
||||
|
||||
public val foo: Int =
|
||||
1
|
||||
@@ -1,7 +0,0 @@
|
||||
@file:JvmName("SameNameProperty")
|
||||
@file:JvmMultifileClass
|
||||
package customLib.property
|
||||
|
||||
public fun someFun(): Int {
|
||||
return 1
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package customLib.simpleLibFile
|
||||
|
||||
public fun foo() {
|
||||
1 + 1
|
||||
}
|
||||
|
||||
class B {
|
||||
public var prop: Int = 1
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
@file:JvmName("SameNameTwoFunDifferentSignature")
|
||||
@file:JvmMultifileClass
|
||||
package customLib.twoFunDifferentSignature
|
||||
|
||||
public fun twoFunDifferentSignatureFun(): Int {
|
||||
return 1
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
@file:JvmName("SameNameTwoFunDifferentSignature")
|
||||
@file:JvmMultifileClass
|
||||
package customLib.twoFunDifferentSignature
|
||||
|
||||
public fun twoFunDifferentSignatureFun(i: Int): Int {
|
||||
return 1
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package forTests;
|
||||
|
||||
public interface Computable <T> {
|
||||
T compute();
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package forTests;
|
||||
|
||||
public class FieldsGetters {
|
||||
public static class PublicField {
|
||||
public String foo = "a";
|
||||
}
|
||||
|
||||
public static class PackagePrivateField {
|
||||
String foo = "b";
|
||||
}
|
||||
|
||||
public static class ProtectedField {
|
||||
protected String foo = "c";
|
||||
}
|
||||
|
||||
public static class PrivateField {
|
||||
private String foo = "d";
|
||||
}
|
||||
|
||||
public static class PublicFieldGetter {
|
||||
public final String foo = "a";
|
||||
|
||||
public String getFoo() {
|
||||
return "b";
|
||||
}
|
||||
}
|
||||
|
||||
public static class PrivateFieldPublicGetter {
|
||||
private final String foo = "c";
|
||||
|
||||
public String getFoo() {
|
||||
return "d";
|
||||
}
|
||||
}
|
||||
|
||||
public static class PrivateFieldPrivateGetter {
|
||||
private final String foo = "e";
|
||||
|
||||
public String getFoo() {
|
||||
return "f";
|
||||
}
|
||||
}
|
||||
|
||||
public static class PublicGetter1 extends PublicField {
|
||||
public String getFoo() {
|
||||
return "g";
|
||||
}
|
||||
}
|
||||
|
||||
public static class PublicGetter2 extends PackagePrivateField {
|
||||
public String getFoo() {
|
||||
return "h";
|
||||
}
|
||||
}
|
||||
|
||||
public static class PrivateGetter1 extends PrivateField {
|
||||
private String getFoo() {
|
||||
return "g";
|
||||
}
|
||||
}
|
||||
|
||||
public static class PublicGetterOnly {
|
||||
public String getFoo() {
|
||||
return "a";
|
||||
}
|
||||
}
|
||||
|
||||
public static class PublicFieldAndGetterInParent extends PublicGetterOnly {
|
||||
public String foo = "b";
|
||||
}
|
||||
|
||||
public abstract class AbstractGetter {
|
||||
public String foo = "c";
|
||||
public abstract String getFoo();
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package forTests;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
public class MyJavaClass {
|
||||
public void testFun() {
|
||||
int i = 1;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String testNotNullFun() {
|
||||
return "a";
|
||||
}
|
||||
|
||||
public static int staticFun(Object s) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static <T> T runReadAction(@NotNull Computable<T> computation) {
|
||||
return computation.compute();
|
||||
}
|
||||
|
||||
private static class PrivateJavaClass {
|
||||
public final int prop = 1;
|
||||
}
|
||||
|
||||
public static class BaseClass {
|
||||
public final int i2 = 1;
|
||||
}
|
||||
|
||||
public BaseClass getBaseClassValue() {
|
||||
return new BaseClass();
|
||||
}
|
||||
public BaseClass getInnerClassValue() {
|
||||
return new InnerClass();
|
||||
}
|
||||
|
||||
public static class InnerClass extends BaseClass {
|
||||
public final int i = 1;
|
||||
}
|
||||
|
||||
public static class RawA<T> {
|
||||
public int foo(List<T> p) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RawADerived extends RawA {
|
||||
|
||||
}
|
||||
|
||||
// Method with sam conversion for step into test
|
||||
public void other(Runnable runnable) {
|
||||
runnable.run();
|
||||
}
|
||||
|
||||
public MyJavaClass() {}
|
||||
|
||||
// Constructor with sam conversion for step into test
|
||||
public MyJavaClass(Runnable runnable) {}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package forTests;
|
||||
|
||||
public class SamConversion {
|
||||
public interface Runnable {
|
||||
public abstract void run();
|
||||
}
|
||||
|
||||
public static void doAction(Runnable runnable) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package forTests
|
||||
|
||||
import kotlin.coroutines.Continuation
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
import kotlin.coroutines.startCoroutine
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation<Any?> {
|
||||
companion object : EmptyContinuation()
|
||||
override fun resumeWith(result: Result<Any?>) { result.getOrThrow() }
|
||||
}
|
||||
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
class WaitFinish(
|
||||
private val timeout: Long = 5,
|
||||
private val unit: TimeUnit = TimeUnit.SECONDS
|
||||
) {
|
||||
private val cdl = CountDownLatch(1)
|
||||
|
||||
fun finish() {
|
||||
cdl.countDown()
|
||||
}
|
||||
|
||||
fun waitEnd() {
|
||||
if (!cdl.await(timeout, unit)) {
|
||||
throw java.lang.IllegalStateException("Too long wait in debugger test!")
|
||||
}
|
||||
|
||||
Thread.sleep(10)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package inlineFunctionOtherPackage
|
||||
|
||||
inline fun myFun(f: () -> Int): Int = f()
|
||||
|
||||
val String.prop: String
|
||||
get() {
|
||||
return "a"
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package inlineFunctionSameLines
|
||||
|
||||
inline fun <reified T> myFun(t: T): Int {
|
||||
val a = 1
|
||||
val b = 2
|
||||
val c = 3
|
||||
val d = 4
|
||||
return 1
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package inlineFunctionWithBreakpoint
|
||||
|
||||
inline fun myFun(f: (Int) -> Unit) {
|
||||
f(1)
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package forTests.javaContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class JavaClass {
|
||||
public void simple() {
|
||||
int breakpoint = 1;
|
||||
}
|
||||
|
||||
public void localVariable() {
|
||||
int i = 1;
|
||||
int breakpoint = 1;
|
||||
}
|
||||
|
||||
public void block() {
|
||||
int bodyVal = 1;
|
||||
if (true) {
|
||||
int thenVal = 1;
|
||||
int breakpoint = 1;
|
||||
}
|
||||
else {
|
||||
int elseVal = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void imports() {
|
||||
ArrayList<Integer> list = createList();
|
||||
int breakpoint = 1;
|
||||
}
|
||||
|
||||
private ArrayList<Integer> createList() {
|
||||
ArrayList<Integer> list = new ArrayList<Integer>();
|
||||
list.add(1);
|
||||
list.add(2);
|
||||
return list;
|
||||
}
|
||||
|
||||
public void markObject() {
|
||||
Integer i = 1;
|
||||
int breakpoint = 1;
|
||||
}
|
||||
|
||||
public int javaProperty = 1;
|
||||
private int javaPrivateProperty = 1;
|
||||
|
||||
public void property() {
|
||||
int breakpoint = 1;
|
||||
}
|
||||
|
||||
public interface JavaStatic {
|
||||
static int state() { return 1; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("NewName")
|
||||
package multiFilePackage
|
||||
|
||||
inline fun foo(f: () -> Int) = f()
|
||||
@@ -1,5 +0,0 @@
|
||||
package simple
|
||||
|
||||
// test more than one file for package in JetPositionManager:prepareTypeMapper. the second file in this package is singleBreakpoint/simple.kt
|
||||
fun foo() {
|
||||
}
|
||||
Reference in New Issue
Block a user