Fix line separators for windows in tests
This commit is contained in:
@@ -513,7 +513,7 @@ public class JetTestUtils {
|
||||
String content;
|
||||
|
||||
try {
|
||||
content = StringUtil.convertLineSeparators(FileUtil.loadFile(new File(filePath)));
|
||||
content = FileUtil.loadFile(new File(filePath), true);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -743,7 +743,7 @@ public class JetTestUtils {
|
||||
}
|
||||
|
||||
public static JetFile loadJetFile(@NotNull Project project, @NotNull File ioFile) throws IOException {
|
||||
String text = FileUtil.loadFile(ioFile);
|
||||
String text = FileUtil.loadFile(ioFile, true);
|
||||
return JetPsiFactory.createPhysicalFile(project, ioFile.getName(), text);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public abstract class AbstractCheckLocalVariablesTableTest extends TestCaseWithT
|
||||
|
||||
protected void doTest(@NotNull String ktFileName) throws Exception {
|
||||
ktFile = new File(ktFileName);
|
||||
String text = FileUtil.loadFile(ktFile);
|
||||
String text = FileUtil.loadFile(ktFile, true);
|
||||
|
||||
JetFile psiFile = JetTestUtils.createFile(ktFile.getName(), text, jetCoreEnvironment.getProject());
|
||||
assert psiFile != null;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class LineNumberTest extends TestCaseWithTmpdir {
|
||||
|
||||
String text;
|
||||
try {
|
||||
text = FileUtil.loadFile(file);
|
||||
text = FileUtil.loadFile(file, true);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw UtilsPackage.rethrow(e);
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public abstract class AbstractDefaultArgumentsReflectionTest extends CodegenTest
|
||||
protected void doTest(String path) throws IOException {
|
||||
loadFileByFullPath(path);
|
||||
|
||||
String fileText = FileUtil.loadFile(new File(path));
|
||||
String fileText = FileUtil.loadFile(new File(path), true);
|
||||
String className = loadInstructionValue(fileText, "CLASS");
|
||||
boolean hasDefaultConstructor = loadInstructionValue(fileText, "HAS_DEFAULT_CONSTRUCTOR").equals("true");
|
||||
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public abstract class AbstractDescriptorSerializationTest extends KotlinTestWith
|
||||
protected void doTest(@NotNull String path) throws IOException {
|
||||
File ktFile = new File(path);
|
||||
ModuleDescriptor moduleDescriptor = LazyResolveTestUtil.resolveEagerly(Collections.singletonList(
|
||||
JetTestUtils.createFile(ktFile.getName(), FileUtil.loadFile(ktFile), getProject())
|
||||
JetTestUtils.createFile(ktFile.getName(), FileUtil.loadFile(ktFile, true), getProject())
|
||||
), getEnvironment());
|
||||
|
||||
PackageViewDescriptor testPackage = moduleDescriptor.getPackage(FqName.topLevel(TEST_PACKAGE_NAME));
|
||||
|
||||
@@ -61,7 +61,7 @@ abstract class AbstractEvaluateExpressionTest: AbstractAnnotationDescriptorResol
|
||||
|
||||
private fun doTest(path: String, getValueToTest: (JetProperty, BindingContext) -> String) {
|
||||
val myFile = File(path)
|
||||
val fileText = FileUtil.loadFile(myFile)
|
||||
val fileText = FileUtil.loadFile(myFile, true)
|
||||
val packageView = getPackage(fileText)
|
||||
|
||||
val propertiesForTest = getObjectsToTest(fileText)
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends TestCaseWit
|
||||
@NotNull Disposable disposable
|
||||
) throws IOException {
|
||||
|
||||
String text = FileUtil.loadFile(file);
|
||||
String text = FileUtil.loadFile(file, true);
|
||||
|
||||
JetFile psiFile = JetTestUtils.createFile(file.getName(), text, jetCoreEnvironment.getProject());
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
assertTrue(compiledDir.mkdir());
|
||||
|
||||
List<File> srcFiles = JetTestUtils.createTestFiles(
|
||||
new File(javaFileName).getName(), FileUtil.loadFile(new File(javaFileName)),
|
||||
new File(javaFileName).getName(), FileUtil.loadFile(new File(javaFileName), true),
|
||||
new JetTestUtils.TestFileFactory<File>() {
|
||||
@Override
|
||||
public File create(String fileName, String text, Map<String, String> directives) {
|
||||
|
||||
@@ -66,7 +66,7 @@ public abstract class AbstractWriteSignatureTest extends TestCaseWithTmpdir {
|
||||
|
||||
protected void doTest(String ktFileName) throws Exception {
|
||||
File ktFile = new File(ktFileName);
|
||||
String text = FileUtil.loadFile(ktFile);
|
||||
String text = FileUtil.loadFile(ktFile, true);
|
||||
|
||||
JetFile psiFile = JetTestUtils.createFile(ktFile.getName(), text, jetCoreEnvironment.getProject());
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class JetPsiUtilTest extends JetLiteFixture {
|
||||
}
|
||||
|
||||
public void testIsLocalClass() throws IOException {
|
||||
String text = FileUtil.loadFile(new File(getTestDataPath() + "/psiUtil/isLocalClass.kt"));
|
||||
String text = FileUtil.loadFile(new File(getTestDataPath() + "/psiUtil/isLocalClass.kt"), true);
|
||||
JetClass aClass = JetPsiFactory.createClass(getProject(), text);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -49,7 +49,7 @@ public class JetCodeConformanceTest extends TestCase {
|
||||
|
||||
public void testParserCode() throws Exception {
|
||||
for (File sourceFile : FileUtil.findFilesByMask(JAVA_FILE_PATTERN, new File("compiler/frontend/src/org/jetbrains/jet/lang/parsing"))) {
|
||||
String source = FileUtil.loadFile(sourceFile);
|
||||
String source = FileUtil.loadFile(sourceFile, true);
|
||||
|
||||
Pattern atPattern = Pattern.compile("assert.*?[^_]at.*?$", Pattern.MULTILINE);
|
||||
Matcher matcher = atPattern.matcher(source);
|
||||
@@ -68,7 +68,7 @@ public class JetCodeConformanceTest extends TestCase {
|
||||
continue;
|
||||
}
|
||||
|
||||
String source = FileUtil.loadFile(sourceFile);
|
||||
String source = FileUtil.loadFile(sourceFile, true);
|
||||
|
||||
if (source.contains("@author") && JAVADOC_PATTERN.matcher(source).find()) { // .contains() is invoked for optimization
|
||||
filesWithAuthorJavadoc.add(sourceFile);
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import org.jetbrains.jet.JetTestUtils
|
||||
|
||||
public abstract class AbstractAnnotationParameterTest : AbstractAnnotationDescriptorResolveTest() {
|
||||
fun doTest(path: String) {
|
||||
val fileText = FileUtil.loadFile(File(path))
|
||||
val fileText = FileUtil.loadFile(File(path), true)
|
||||
val packageView = getPackage(fileText)
|
||||
val classDescriptor = AbstractAnnotationDescriptorResolveTest.getClassDescriptor(packageView, "MyClass")
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class RecursiveDescriptorProcessorTest extends KotlinTestWithEnvironment
|
||||
public void testRecursive() throws Exception {
|
||||
File ktFile = new File("compiler/testData/recursiveProcessor/declarations.kt");
|
||||
File txtFile = new File("compiler/testData/recursiveProcessor/declarations.txt");
|
||||
String text = FileUtil.loadFile(ktFile);
|
||||
String text = FileUtil.loadFile(ktFile, true);
|
||||
JetFile jetFile = JetTestUtils.createFile("declarations.kt", text, getEnvironment().getProject());
|
||||
AnalyzeExhaust exhaust = JetTestUtils.analyzeFile(jetFile);
|
||||
PackageViewDescriptor testPackage = exhaust.getModuleDescriptor().getPackage(FqName.topLevel(Name.identifier("test")));
|
||||
|
||||
@@ -80,7 +80,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
|
||||
|
||||
private JetScope getContextScope() throws IOException {
|
||||
// todo comments
|
||||
String text = FileUtil.loadFile(new File("compiler/testData/type-substitutor.kt"));
|
||||
String text = FileUtil.loadFile(new File("compiler/testData/type-substitutor.kt"), true);
|
||||
JetFile jetFile = JetPsiFactory.createFile(getProject(), text);
|
||||
ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(Collections.singletonList(jetFile), getEnvironment());
|
||||
JetScope topLevelDeclarations = module.getPackage(FqName.ROOT).getMemberScope();
|
||||
|
||||
Reference in New Issue
Block a user