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