From f8d73f78a1c150213cc9a2f136fc31d2c84aec34 Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Sat, 3 Nov 2012 13:14:42 +0400 Subject: [PATCH] use same charset for file and expected data --- .../fixtures/impl/CodeInsightTestFixtureImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 e7fe1775c46c..2005a33893cd 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -1569,9 +1569,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig final RangeMarker selEndMarker; final boolean blockSelection; - static SelectionAndCaretMarkupLoader fromFile(String path, Project project) throws IOException { - return new SelectionAndCaretMarkupLoader(StringUtil.convertLineSeparators(FileUtil.loadFile(new File(path))), - project); + static SelectionAndCaretMarkupLoader fromFile(String path, Project project, String charset) throws IOException { + return new SelectionAndCaretMarkupLoader( + StringUtil.convertLineSeparators(FileUtil.loadFile(new File(path), charset)), project); } static SelectionAndCaretMarkupLoader fromFile(VirtualFile file, Project project) { @@ -1645,8 +1645,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig final String newText = myFile == originalFile ? fileText.substring(0, caret) + "" + fileText.substring(caret) : fileText; VfsUtil.saveText(result, newText);*/ - checkResult(expectedFile, stripTrailingSpaces, - SelectionAndCaretMarkupLoader.fromFile(path, getProject()), fileText); + VirtualFile virtualFile = originalFile.getVirtualFile(); + String charset = virtualFile == null? null : virtualFile.getCharset().name(); + checkResult(expectedFile, stripTrailingSpaces, SelectionAndCaretMarkupLoader.fromFile(path, getProject(), charset), fileText); }