From 9d89e6598e48682cb520882110f1f3aeb3dab269 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 6 Sep 2011 23:15:48 +0200 Subject: [PATCH] fix surrounder tests --- .../surroundWith/SurrounderOrderTest.groovy | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/surroundWith/SurrounderOrderTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/surroundWith/SurrounderOrderTest.groovy index 7ae72e0a5154..4a67d79f2443 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/surroundWith/SurrounderOrderTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/surroundWith/SurrounderOrderTest.groovy @@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.surroundWith import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase import com.intellij.codeInsight.generation.surroundWith.SurroundWithHandler import com.intellij.openapi.actionSystem.Separator +import com.intellij.openapi.application.WriteAction /** * @author peter @@ -55,16 +56,23 @@ class SurrounderOrderTest extends LightCodeInsightFixtureTestCase { private List getSurrounders(final String fileText) { myFixture.configureByText("a.groovy", fileText) - def actions = SurroundWithHandler.buildSurroundActions(project, myFixture.editor, myFixture.file, null) - def names = [] - for (action in actions) { - if (action instanceof Separator) { - break - } + def token = WriteAction.start() - def text = action.templatePresentation.text - names << text.substring(text.indexOf('. ') + 2) + try { + def actions = SurroundWithHandler.buildSurroundActions(project, myFixture.editor, myFixture.file, null) + def names = [] + for (action in actions) { + if (action instanceof Separator) { + break + } + + def text = action.templatePresentation.text + names << text.substring(text.indexOf('. ') + 2) + } + return names + } + finally { + token.finish() } - return names } } \ No newline at end of file