Workaround package part hash codes in tests on JetPositionManager
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
"" // _DefaultPackage-_DefaultPackage-
|
"" // _DefaultPackage\$_DefaultPackage\$.+
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class A {
|
class A {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
{
|
{
|
||||||
"" // A$foo$1
|
"" // A\$foo\$1
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ package insertInBlock
|
|||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val lambda = {
|
val lambda = {
|
||||||
val a = 1 // insertInBlock/InsertInBlockPackage$foo$lambda$1
|
val a = 1 // insertInBlock/InsertInBlockPackage\$anonymousNamedFunction\$.+\$foo\$lambda\$1
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class A {
|
class A {
|
||||||
class object {
|
class object {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
"" // A$object
|
"" // A\$object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun A.foo() {
|
fun A.foo() {
|
||||||
"" // a/APackage-extensionFunction-
|
"" // a/APackage\$extensionFunction\$.+
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class A {
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
{
|
{
|
||||||
fun innerFoo() {
|
fun innerFoo() {
|
||||||
"" // A$foo$1$1
|
"" // A\$foo\$1\$1
|
||||||
}
|
}
|
||||||
innerFoo()
|
innerFoo()
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class A {
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
val a = {
|
val a = {
|
||||||
fun innerFoo() {
|
fun innerFoo() {
|
||||||
val b = {} // A$foo$a$1$1
|
val b = {} // A\$foo\$a\$1\$1
|
||||||
}
|
}
|
||||||
innerFoo()
|
innerFoo()
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class A {
|
class A {
|
||||||
class B {
|
class B {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
"" // A$B
|
"" // A\$B
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package test
|
|||||||
|
|
||||||
fun foo(): String {
|
fun foo(): String {
|
||||||
fun bar(): String {
|
fun bar(): String {
|
||||||
return "" // test/TestPackage$foo$1
|
return "" // test/TestPackage\$localFunction\$.+\$foo\$1
|
||||||
}
|
}
|
||||||
return bar()
|
return bar()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
"" // test/TestPackage-a-
|
"" // test/TestPackage\$a\$.+
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
fun bar() {
|
fun bar() {
|
||||||
foo(); // test/TestPackage-b-
|
foo(); // test/TestPackage\$b\$.+
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
"" // test/TestPackage-a-
|
"" // test/TestPackage\$a\$.+
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
fun bar() {
|
fun bar() {
|
||||||
"" // test/TestPackage-a-
|
"" // test/TestPackage\$a\$.+
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
fun baz() {
|
fun baz() {
|
||||||
"" // test/TestPackage-a-
|
"" // test/TestPackage\$a\$.+
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
fun quux() {
|
fun quux() {
|
||||||
"" // test/TestPackage-a-
|
"" // test/TestPackage\$a\$.+
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class A {
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
object {
|
object {
|
||||||
fun bar() {
|
fun bar() {
|
||||||
"" // A$foo$1
|
"" // A\$foo\$1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
"" // test/TestPackage-package
|
"" // test/TestPackage\$package\$.+
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
package prop
|
package prop
|
||||||
|
|
||||||
val foo: Int = 5 // prop/PropPackage-topLevelPropertyInitializer
|
val foo: Int = 5 // prop/PropPackage\$topLevelPropertyInitializer\$.+
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
trait A {
|
trait A {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
"" // A$$TImpl
|
"" // A\$\$TImpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public abstract class AbstractJetPositionManagerTest extends MultiFileTestCase {
|
public abstract class AbstractJetPositionManagerTest extends MultiFileTestCase {
|
||||||
// Breakpoint is given as a line comment on a specific line, containing the name of the class, where that line can be found.
|
// Breakpoint is given as a line comment on a specific line, containing the regexp to match the name of the class where that line
|
||||||
// This pattern matches against these line comments and saves the class name in the first group
|
// can be found. This pattern matches against these line comments and saves the class name in the first group
|
||||||
private static final Pattern BREAKPOINT_PATTERN = Pattern.compile("^.*//\\s*([a-zA-Z0-9._/$]*)\\s*$");
|
private static final Pattern BREAKPOINT_PATTERN = Pattern.compile("^.*//\\s*(.+)\\s*$");
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
@@ -175,10 +175,8 @@ public abstract class AbstractJetPositionManagerTest extends MultiFileTestCase {
|
|||||||
assertNotNull(classes);
|
assertNotNull(classes);
|
||||||
assertEquals(1, classes.size());
|
assertEquals(1, classes.size());
|
||||||
ReferenceType type = classes.get(0);
|
ReferenceType type = classes.get(0);
|
||||||
if (!breakpoint.className.contains("$src$")) // don't want to deal with hashCodes in test
|
assertTrue("Type name " + type.name() + " doesn't match " + breakpoint.classNameRegexp,
|
||||||
assertEquals(breakpoint.className, type.name());
|
type.name().matches(breakpoint.classNameRegexp));
|
||||||
else
|
|
||||||
assertTrue(type.name().startsWith(breakpoint.className));
|
|
||||||
|
|
||||||
// JDI names are of form "package.Class$InnerClass"
|
// JDI names are of form "package.Class$InnerClass"
|
||||||
ReferenceType typeWithFqName = new MockReferenceType(type.name().replace('/', '.'));
|
ReferenceType typeWithFqName = new MockReferenceType(type.name().replace('/', '.'));
|
||||||
@@ -193,12 +191,12 @@ public abstract class AbstractJetPositionManagerTest extends MultiFileTestCase {
|
|||||||
private static class Breakpoint {
|
private static class Breakpoint {
|
||||||
private final JetFile file;
|
private final JetFile file;
|
||||||
private final int lineNumber; // 0-based
|
private final int lineNumber; // 0-based
|
||||||
private final String className;
|
private final String classNameRegexp;
|
||||||
|
|
||||||
private Breakpoint(JetFile file, int lineNumber, String className) {
|
private Breakpoint(JetFile file, int lineNumber, String classNameRegexp) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.lineNumber = lineNumber;
|
this.lineNumber = lineNumber;
|
||||||
this.className = className;
|
this.classNameRegexp = classNameRegexp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user