Fixed line separators for fix maven build on Windows.
This commit is contained in:
@@ -16,13 +16,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.k2js.test.semantics;
|
package org.jetbrains.k2js.test.semantics;
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import org.jetbrains.k2js.config.EcmaVersion;
|
import org.jetbrains.k2js.config.EcmaVersion;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static com.intellij.openapi.util.io.FileUtil.loadTextAndClose;
|
|
||||||
|
|
||||||
public final class StringTest extends AbstractExpressionTest {
|
public final class StringTest extends AbstractExpressionTest {
|
||||||
|
|
||||||
public StringTest() {
|
public StringTest() {
|
||||||
@@ -75,8 +74,7 @@ public final class StringTest extends AbstractExpressionTest {
|
|||||||
private void checkHasNoToStringCalls() throws IOException {
|
private void checkHasNoToStringCalls() throws IOException {
|
||||||
for (EcmaVersion ecmaVersion : DEFAULT_ECMA_VERSIONS) {
|
for (EcmaVersion ecmaVersion : DEFAULT_ECMA_VERSIONS) {
|
||||||
String filePath = getOutputFilePath(getTestName(true) + ".kt", ecmaVersion);
|
String filePath = getOutputFilePath(getTestName(true) + ".kt", ecmaVersion);
|
||||||
//noinspection IOResourceOpenedButNotSafelyClosed
|
String text = FileUtil.loadFile(new File(filePath), /*convertLineSeparators = */ true);
|
||||||
String text = loadTextAndClose(new FileInputStream(filePath));
|
|
||||||
assertFalse(filePath + " should not contain toString calls", text.contains("toString"));
|
assertFalse(filePath + " should not contain toString calls", text.contains("toString"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.k2js.config.EcmaVersion;
|
import org.jetbrains.k2js.config.EcmaVersion;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
@@ -49,9 +48,7 @@ public final class JsTestUtils {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String readFile(@NotNull String path) throws IOException {
|
public static String readFile(@NotNull String path) throws IOException {
|
||||||
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
|
return FileUtil.loadFile(new File(path), /*convertLineSeparators = */ true);
|
||||||
FileInputStream stream = new FileInputStream(new File(path));
|
|
||||||
return FileUtil.loadTextAndClose(stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
|||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.util.Key;
|
import com.intellij.openapi.util.Key;
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
import com.intellij.openapi.vfs.*;
|
import com.intellij.openapi.vfs.*;
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import com.intellij.psi.PsiManager;
|
import com.intellij.psi.PsiManager;
|
||||||
@@ -120,7 +121,7 @@ public class LibrarySourcesConfig extends Config {
|
|||||||
ZipEntry entry = zipEntries.nextElement();
|
ZipEntry entry = zipEntries.nextElement();
|
||||||
if (!entry.isDirectory() && entry.getName().endsWith(".kt")) {
|
if (!entry.isDirectory() && entry.getName().endsWith(".kt")) {
|
||||||
InputStream stream = file.getInputStream(entry);
|
InputStream stream = file.getInputStream(entry);
|
||||||
String text = FileUtil.loadTextAndClose(stream);
|
String text = StringUtil.convertLineSeparators(FileUtil.loadTextAndClose(stream));
|
||||||
JetFile jetFile = JetPsiFactory.createFile(getProject(), entry.getName(), text);
|
JetFile jetFile = JetPsiFactory.createFile(getProject(), entry.getName(), text);
|
||||||
jetFile.putUserData(EXTERNAL_MODULE_NAME, UNKNOWN_EXTERNAL_MODULE_NAME);
|
jetFile.putUserData(EXTERNAL_MODULE_NAME, UNKNOWN_EXTERNAL_MODULE_NAME);
|
||||||
result.add(jetFile);
|
result.add(jetFile);
|
||||||
@@ -156,4 +157,4 @@ public class LibrarySourcesConfig extends Config {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.k2js.config;
|
|||||||
|
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
import org.jetbrains.jet.lang.psi.JetPsiFactory;
|
import org.jetbrains.jet.lang.psi.JetPsiFactory;
|
||||||
@@ -73,7 +74,7 @@ public final class MetaInfServices {
|
|||||||
// lets try to discover the file
|
// lets try to discover the file
|
||||||
InputStream stream = loadClasspathResource(line);
|
InputStream stream = loadClasspathResource(line);
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
String text = FileUtil.loadTextAndClose(stream);
|
String text = StringUtil.convertLineSeparators(FileUtil.loadTextAndClose(stream));
|
||||||
libFiles.add(JetPsiFactory.createFile(project, line, text));
|
libFiles.add(JetPsiFactory.createFile(project, line, text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user