mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Groovy] fix GroovyDebuggerTest (IDEA-327339)
GitOrigin-RevId: da4d0f263837670d4fb2e788850c3b639414529c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9e9ef59c7b
commit
0c95de9b41
@@ -93,7 +93,7 @@ public interface DebuggerMethods extends CompilerMethods {
|
||||
.addLineBreakpoint(FileDocumentManager.getInstance().getDocument(file), line));
|
||||
}
|
||||
|
||||
default SuspendContextImpl waitForBreakpoint() throws RuntimeException {
|
||||
default void waitForBreakpoint() throws RuntimeException {
|
||||
getLogger().debug("waitForBreakpoint");
|
||||
final Semaphore semaphore = new Semaphore();
|
||||
semaphore.down();
|
||||
@@ -117,7 +117,6 @@ public interface DebuggerMethods extends CompilerMethods {
|
||||
}
|
||||
SuspendContextImpl context = suspendManager.getPausedContext();
|
||||
assertNotNull("too long process, terminated=" + process.getProcessHandler().isProcessTerminated(), context);
|
||||
return context;
|
||||
}
|
||||
|
||||
default void resume() {
|
||||
@@ -128,9 +127,11 @@ public interface DebuggerMethods extends CompilerMethods {
|
||||
}
|
||||
|
||||
default SourcePosition getSourcePosition() {
|
||||
final EvaluationContextImpl context = evaluationContext();
|
||||
Computable<SourcePosition> a = () -> ContextUtil.getSourcePosition(context);
|
||||
return ApplicationManager.getApplication().runReadAction(a);
|
||||
return managed(() -> {
|
||||
final EvaluationContextImpl context = evaluationContext();
|
||||
Computable<SourcePosition> a = () -> ContextUtil.getSourcePosition(context);
|
||||
return ApplicationManager.getApplication().runReadAction(a);
|
||||
});
|
||||
}
|
||||
|
||||
default EvaluationContextImpl evaluationContext() {
|
||||
|
||||
@@ -273,24 +273,30 @@ public class GroovyDebuggerTest extends GroovyCompilerTestCase implements Debugg
|
||||
|
||||
runDebugger(file, () -> {
|
||||
waitForBreakpoint();
|
||||
assert myClass.get().equals(getSourcePosition().getFile().getVirtualFile());
|
||||
assertEquals(myClass.get(), getSourcePosition().getFile().getVirtualFile());
|
||||
eval("a", "2");
|
||||
});
|
||||
}
|
||||
|
||||
public void test_groovy_source_named_java_in_lib_source() throws IOException {
|
||||
public void test_groovy_source_named_java_in_lib_source() {
|
||||
final TempDirTestFixtureImpl tempDir = new TempDirTestFixtureImpl();
|
||||
EdtTestUtil.runInEdtAndWait(() -> {
|
||||
disposeOnTearDown(() -> {
|
||||
try {
|
||||
tempDir.tearDown();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
tempDir.createFile("pkg/java.groovy", "class java {}");
|
||||
PsiTestUtil.addLibrary(getModule(), "lib", tempDir.getFile("").getPath(), ArrayUtil.EMPTY_STRING_ARRAY, new String[]{""});
|
||||
try {
|
||||
tempDir.setUp();
|
||||
disposeOnTearDown(() -> {
|
||||
try {
|
||||
tempDir.tearDown();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
tempDir.createFile("pkg/java.groovy", "class java {}");
|
||||
PsiTestUtil.addLibrary(getModule(), "lib", tempDir.getFile("").getPath(), ArrayUtil.EMPTY_STRING_ARRAY, new String[]{""});
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
|
||||
ActionsKt.runReadAction(() -> {
|
||||
@@ -371,7 +377,7 @@ public class GroovyDebuggerTest extends GroovyCompilerTestCase implements Debugg
|
||||
addBreakpoint("module1/Scr.groovy", 0);
|
||||
runDebugger(scr, () -> {
|
||||
waitForBreakpoint();
|
||||
assert scr.equals(getSourcePosition().getFile());
|
||||
assertEquals(scr, getSourcePosition().getFile());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user