Add file comparison feature to surround with tests
This commit is contained in:
+10
-1
@@ -23,12 +23,14 @@ import com.intellij.lang.surroundWith.Surrounder;
|
||||
import com.intellij.openapi.editor.SelectionModel;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.rt.execution.junit.FileComparisonFailure;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.surroundWith.expression.*;
|
||||
import org.jetbrains.kotlin.idea.codeInsight.surroundWith.statement.*;
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
@@ -122,7 +124,14 @@ public abstract class AbstractSurroundWithTest extends LightCodeInsightTestCase
|
||||
|
||||
private void invokeSurroundAndCheck(@NotNull String path, @NotNull Surrounder surrounder) {
|
||||
SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
|
||||
checkResultByFile(path + ".after");
|
||||
|
||||
String filePath = path + ".after";
|
||||
try {
|
||||
checkResultByFile(filePath);
|
||||
}
|
||||
catch (FileComparisonFailure fileComparisonFailure) {
|
||||
KotlinTestUtils.assertEqualsToFile(new File(filePath), getEditor());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user