use same charset for file and expected data

This commit is contained in:
Gregory.Shrago
2012-11-03 13:14:42 +04:00
parent 999fdc279b
commit f8d73f78a1
@@ -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) + "<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);
}