diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 28ec9231d123..799a7ad7822a 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -1611,7 +1611,13 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig actualText = StringUtil.convertLineSeparators(actualText); if (!Comparing.equal(expectedText, actualText)) { - if (loader.filePath != null && !loader.caretState.hasExplicitCaret()) { + if (loader.filePath != null) { + if (loader.caretState.hasExplicitCaret()) { + int offset = editor.getCaretModel().getOffset(); + if (offset > -1) { + actualText = new StringBuilder(actualText).insert(offset, "").toString(); + } + } throw new FileComparisonFailure(expectedFile, expectedText, actualText, loader.filePath); } else {