mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diagnostics for tests
(cherry picked from commit cfc62a20a2199e53758520459344fecb2274f535)
This commit is contained in:
+16
-11
@@ -113,18 +113,23 @@ public class JavaSurroundWithTest extends LightCodeInsightTestCase {
|
||||
}
|
||||
|
||||
private void doTestWithTemplateFinish(@NotNull String fileName, final Surrounder surrounder, @Nullable String textToType)
|
||||
throws Exception
|
||||
{
|
||||
((TemplateManagerImpl)TemplateManager.getInstance(getProject())).setTemplateTesting(true);
|
||||
configureByFile(BASE_PATH + fileName + ".java");
|
||||
SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
|
||||
if (textToType != null) {
|
||||
type(textToType);
|
||||
throws Exception {
|
||||
final TemplateManagerImpl templateManager = (TemplateManagerImpl)TemplateManager.getInstance(getProject());
|
||||
try {
|
||||
templateManager.setTemplateTesting(true);
|
||||
configureByFile(BASE_PATH + fileName + ".java");
|
||||
SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
|
||||
if (textToType != null) {
|
||||
type(textToType);
|
||||
}
|
||||
TemplateState templateState = TemplateManagerImpl.getTemplateState(getEditor());
|
||||
assertNotNull(templateState);
|
||||
templateState.nextTab();
|
||||
checkResultByFile(BASE_PATH + fileName + "_after.java");
|
||||
}
|
||||
finally {
|
||||
templateManager.setTemplateTesting(false);
|
||||
}
|
||||
TemplateState templateState = TemplateManagerImpl.getTemplateState(getEditor());
|
||||
assertNotNull(templateState);
|
||||
templateState.nextTab();
|
||||
checkResultByFile(BASE_PATH + fileName + "_after.java");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.command.undo.UndoManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
@@ -61,6 +62,16 @@ public class StartMarkAction extends BasicUndoableAction {
|
||||
myCommandName = commandName;
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void checkCleared() {
|
||||
try {
|
||||
assert ourCurrentMark == null;
|
||||
}
|
||||
finally {
|
||||
ourCurrentMark = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static StartMarkAction start(Editor editor, Project project, String commandName) throws AlreadyStartedException {
|
||||
if (ourCurrentMark != null) {
|
||||
throw new AlreadyStartedException(ourCurrentMark.myCommandName,
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.command.impl.StartMarkAction;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
@@ -190,6 +191,7 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
myOldCodeStyleSettings = null;
|
||||
|
||||
VariableInplaceRenamer.checkCleared();
|
||||
StartMarkAction.checkCleared();
|
||||
}
|
||||
|
||||
protected void storeSettings() {
|
||||
|
||||
Reference in New Issue
Block a user