Fix line separators for windows in tests

This commit is contained in:
Natalia Ukhorskaya
2014-03-07 17:14:38 +04:00
parent 1fdd3bd615
commit d9d045cbb2
35 changed files with 45 additions and 45 deletions
@@ -52,7 +52,7 @@ public abstract class AbstractJetQuickDocProviderTest extends LightCodeInsightFi
String info = CtrlMouseHandler.getInfo(targetElement, element);
File testDataFile = new File(path);
String textData = FileUtil.loadFile(testDataFile);
String textData = FileUtil.loadFile(testDataFile, true);
List<String> directives = InTextDirectivesUtils.findLinesWithPrefixesRemoved(textData, "INFO:");
if (directives.isEmpty()) {
@@ -265,7 +265,7 @@ public abstract class AbstractJetFindUsagesTest extends LightCodeInsightFixtureT
protected <T extends PsiElement> void doTest(@NotNull String path) throws Exception {
File mainFile = new File(path);
final String mainFileName = mainFile.getName();
String mainFileText = FileUtil.loadFile(mainFile);
String mainFileText = FileUtil.loadFile(mainFile, true);
final String prefix = mainFileName.substring(0, mainFileName.indexOf('.') + 1);
List<String> caretElementClassNames = InTextDirectivesUtils.findLinesWithPrefixesRemoved(mainFileText, "// PSI_ELEMENT: ");
@@ -105,7 +105,7 @@ public class JetTypingIndentationTest extends LightCodeInsightTestCase {
}
public void doFileSettingNewLineTest() throws Exception {
String originalFileText = FileUtil.loadFile(new File(getTestDataPath(), getBeforeFileName()));
String originalFileText = FileUtil.loadFile(new File(getTestDataPath(), getBeforeFileName()), true);
SettingsConfigurator configurator = JetFormatSettingsUtil.createConfigurator(originalFileText);
@@ -48,7 +48,7 @@ public abstract class JetLightCodeInsightFixtureTestCase extends LightCodeInsigh
protected LightProjectDescriptor getProjectDescriptorFromFileDirective() {
if (!isAllFilesPresentInTest()) {
try {
String fileText = FileUtil.loadFile(new File(getTestDataPath(), fileName()));
String fileText = FileUtil.loadFile(new File(getTestDataPath(), fileName()), true);
List<String> withLibraryDirective = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fileText, "WITH_LIBRARY:");
if (!withLibraryDirective.isEmpty()) {
@@ -81,7 +81,7 @@ public abstract class AbstractInsertImportOnPasteTest extends JetLightCodeInsigh
myFixture.checkResultByFile(testFileName.replace(".kt", ".expected.kt"));
if (!InTextDirectivesUtils.isDirectiveDefined(FileUtil.loadFile(testFile), ALLOW_UNRESOLVED_DIRECTIVE)) {
if (!InTextDirectivesUtils.isDirectiveDefined(FileUtil.loadFile(testFile, true), ALLOW_UNRESOLVED_DIRECTIVE)) {
checkNoUnresolvedReferences(toFile);
}
}
@@ -134,7 +134,7 @@ public abstract class AbstractInsertImportOnPasteTest extends JetLightCodeInsigh
if (file.exists()) {
if (dependencyFileName.endsWith(".java")) {
//allow test framework to put it under right directory
myFixture.addClass(FileUtil.loadFile(file));
myFixture.addClass(FileUtil.loadFile(file, true));
}
else {
myFixture.configureByFile(dependencyFileName);
@@ -44,7 +44,7 @@ public abstract class AbstractCodeMoverTest extends LightCodeInsightTestCase {
private void doTest(@NotNull String path, @NotNull Class<? extends StatementUpDownMover> defaultMoverClass) throws Exception {
configureByFile(path);
String fileText = FileUtil.loadFile(new File(path));
String fileText = FileUtil.loadFile(new File(path), true);
String direction = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// MOVE: ");
boolean down = true;
@@ -81,7 +81,7 @@ public abstract class AbstractSurroundWithTest extends LightCodeInsightTestCase
private void doTest(String path, Surrounder surrounder) throws Exception {
configureByFile(path);
String fileText = FileUtil.loadFile(new File(path));
String fileText = FileUtil.loadFile(new File(path), true);
String isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// IS_APPLICABLE: ");
if (isApplicableString != null) {
@@ -162,7 +162,7 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes
private void doTestIntention(@NotNull String path, @NotNull IntentionAction intentionAction) throws Exception {
configureByFile(path);
String fileText = FileUtil.loadFile(new File(path));
String fileText = FileUtil.loadFile(new File(path), true);
String isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// IS_APPLICABLE: ");
boolean isApplicableExpected = isApplicableString == null || isApplicableString.equals("true");
@@ -71,7 +71,7 @@ public abstract class AbstractQuickFixMultiFileTest extends DaemonAnalyzerTestCa
public void run() {
try {
Pair<String, Boolean> pair = LightQuickFixTestCase.parseActionHint(
getFile(),FileUtil.loadFile(new File(getTestDataPath() + beforeFileName)));
getFile(),FileUtil.loadFile(new File(getTestDataPath() + beforeFileName), true));
String text = pair.getFirst();
boolean actionShouldBeAvailable = pair.getSecond();
@@ -70,7 +70,7 @@ public abstract class AbstractJetMoveTest : MultiFileTestCase() {
)!!
}
val config = JsonParser().parse(FileUtil.loadFile(File(path))) as JsonObject
val config = JsonParser().parse(FileUtil.loadFile(File(path), true)) as JsonObject
val action = MoveAction.valueOf(config.getString("type"))
@@ -63,7 +63,7 @@ public abstract class AbstractRenameTest : MultiFileTestCase() {
val module: Module = getModule()!!)
public open fun doTest(path : String) {
val fileText = FileUtil.loadFile(File(path))
val fileText = FileUtil.loadFile(File(path), true)
val jsonParser = JsonParser()
val renameObject = jsonParser.parse(fileText) as JsonObject
@@ -31,8 +31,8 @@ import java.io.File;
public abstract class AbstractJetPsiMatcherTest extends JetLiteFixture {
public void doTestExpressions(@NotNull String path) throws Exception {
String fileText = FileUtil.loadFile(new File(path));
String fileText2 = FileUtil.loadFile(new File(path + ".2"));
String fileText = FileUtil.loadFile(new File(path), true);
String fileText2 = FileUtil.loadFile(new File(path + ".2"), true);
boolean equalityExpected = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// NOT_EQUAL") == null;
@@ -46,8 +46,8 @@ public abstract class AbstractJetPsiMatcherTest extends JetLiteFixture {
}
public void doTestTypes(@NotNull String path) throws Exception {
String fileText = FileUtil.loadFile(new File(path));
String fileText2 = FileUtil.loadFile(new File(path + ".2"));
String fileText = FileUtil.loadFile(new File(path), true);
String fileText2 = FileUtil.loadFile(new File(path + ".2"), true);
boolean equalityExpected = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// NOT_EQUAL") == null;
@@ -50,7 +50,7 @@ public abstract class AbstractSearcherTest extends LightCodeInsightFixtureTestCa
}
protected void checkResult(Query<?> actual) throws IOException {
List<String> expected = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile())), "// SEARCH: ");
List<String> expected = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true), "// SEARCH: ");
List<String> actualModified = new ArrayList<String>();
for (Object member : actual) {
actualModified.add(member.toString());
@@ -42,7 +42,7 @@ public class AnnotatedMembersSearchTest extends AbstractSearcherTest {
private void doTest() throws IOException {
myFixture.configureByFile(getFileName());
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile())),
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true),
"// ANNOTATION: ");
assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty());
String annotationClassName = directives.get(0);
@@ -38,7 +38,7 @@ public class ClassInheritorsSearchTest extends AbstractSearcherTest {
private void doTest() throws IOException {
myFixture.configureByFile(getFileName());
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile())), "// CLASS: ");
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true), "// CLASS: ");
assertFalse("Specify CLASS directive in test file", directives.isEmpty());
String superClassName = directives.get(0);
PsiClass psiClass = getPsiClass(superClassName);
@@ -49,7 +49,7 @@ public class JUnitMembersSearcherTest extends AbstractSearcherTest {
private void doJUnit3test() throws IOException {
myFixture.configureByFile(getFileName());
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile())), "// CLASS: ");
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true), "// CLASS: ");
assertFalse("Specify CLASS directive in test file", directives.isEmpty());
String superClassName = directives.get(0);
PsiClass psiClass = getPsiClass(superClassName);
@@ -58,7 +58,7 @@ public class JUnitMembersSearcherTest extends AbstractSearcherTest {
private void doJUnit4test() throws IOException {
myFixture.configureByFile(getFileName());
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile())),
List<String> directives = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true),
"// ANNOTATION: ");
assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty());
String annotationClassName = directives.get(0);