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
@@ -206,7 +206,7 @@ public class AntTaskTest extends KotlinIntegrationTestBase {
} }
private static void checkFilePrefixPostfix(@NotNull File file, @Nullable File prefix, @Nullable File postfix) throws IOException { private static void checkFilePrefixPostfix(@NotNull File file, @Nullable File prefix, @Nullable File postfix) throws IOException {
String fileContent = FileUtil.loadFile(file); String fileContent = FileUtil.loadFile(file, true);
String prefixContent = FileUtilsPackage.readTextOrEmpty(prefix); String prefixContent = FileUtilsPackage.readTextOrEmpty(prefix);
assertTrue(fileContent.startsWith(prefixContent)); assertTrue(fileContent.startsWith(prefixContent));
@@ -513,7 +513,7 @@ public class JetTestUtils {
String content; String content;
try { try {
content = StringUtil.convertLineSeparators(FileUtil.loadFile(new File(filePath))); content = FileUtil.loadFile(new File(filePath), true);
} }
catch (IOException e) { catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -743,7 +743,7 @@ public class JetTestUtils {
} }
public static JetFile loadJetFile(@NotNull Project project, @NotNull File ioFile) throws IOException { 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); 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 { protected void doTest(@NotNull String ktFileName) throws Exception {
ktFile = new File(ktFileName); ktFile = new File(ktFileName);
String text = FileUtil.loadFile(ktFile); String text = FileUtil.loadFile(ktFile, true);
JetFile psiFile = JetTestUtils.createFile(ktFile.getName(), text, jetCoreEnvironment.getProject()); JetFile psiFile = JetTestUtils.createFile(ktFile.getName(), text, jetCoreEnvironment.getProject());
assert psiFile != null; assert psiFile != null;
@@ -77,7 +77,7 @@ public class LineNumberTest extends TestCaseWithTmpdir {
String text; String text;
try { try {
text = FileUtil.loadFile(file); text = FileUtil.loadFile(file, true);
} }
catch (IOException e) { catch (IOException e) {
throw UtilsPackage.rethrow(e); throw UtilsPackage.rethrow(e);
@@ -38,7 +38,7 @@ public abstract class AbstractDefaultArgumentsReflectionTest extends CodegenTest
protected void doTest(String path) throws IOException { protected void doTest(String path) throws IOException {
loadFileByFullPath(path); loadFileByFullPath(path);
String fileText = FileUtil.loadFile(new File(path)); String fileText = FileUtil.loadFile(new File(path), true);
String className = loadInstructionValue(fileText, "CLASS"); String className = loadInstructionValue(fileText, "CLASS");
boolean hasDefaultConstructor = loadInstructionValue(fileText, "HAS_DEFAULT_CONSTRUCTOR").equals("true"); boolean hasDefaultConstructor = loadInstructionValue(fileText, "HAS_DEFAULT_CONSTRUCTOR").equals("true");
@@ -58,7 +58,7 @@ public abstract class AbstractDescriptorSerializationTest extends KotlinTestWith
protected void doTest(@NotNull String path) throws IOException { protected void doTest(@NotNull String path) throws IOException {
File ktFile = new File(path); File ktFile = new File(path);
ModuleDescriptor moduleDescriptor = LazyResolveTestUtil.resolveEagerly(Collections.singletonList( ModuleDescriptor moduleDescriptor = LazyResolveTestUtil.resolveEagerly(Collections.singletonList(
JetTestUtils.createFile(ktFile.getName(), FileUtil.loadFile(ktFile), getProject()) JetTestUtils.createFile(ktFile.getName(), FileUtil.loadFile(ktFile, true), getProject())
), getEnvironment()); ), getEnvironment());
PackageViewDescriptor testPackage = moduleDescriptor.getPackage(FqName.topLevel(TEST_PACKAGE_NAME)); 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) { private fun doTest(path: String, getValueToTest: (JetProperty, BindingContext) -> String) {
val myFile = File(path) val myFile = File(path)
val fileText = FileUtil.loadFile(myFile) val fileText = FileUtil.loadFile(myFile, true)
val packageView = getPackage(fileText) val packageView = getPackage(fileText)
val propertiesForTest = getObjectsToTest(fileText) val propertiesForTest = getObjectsToTest(fileText)
@@ -138,7 +138,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends TestCaseWit
@NotNull Disposable disposable @NotNull Disposable disposable
) throws IOException { ) throws IOException {
String text = FileUtil.loadFile(file); String text = FileUtil.loadFile(file, true);
JetFile psiFile = JetTestUtils.createFile(file.getName(), text, jetCoreEnvironment.getProject()); JetFile psiFile = JetTestUtils.createFile(file.getName(), text, jetCoreEnvironment.getProject());
@@ -186,7 +186,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
assertTrue(compiledDir.mkdir()); assertTrue(compiledDir.mkdir());
List<File> srcFiles = JetTestUtils.createTestFiles( 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>() { new JetTestUtils.TestFileFactory<File>() {
@Override @Override
public File create(String fileName, String text, Map<String, String> directives) { 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 { protected void doTest(String ktFileName) throws Exception {
File ktFile = new File(ktFileName); 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()); JetFile psiFile = JetTestUtils.createFile(ktFile.getName(), text, jetCoreEnvironment.getProject());
@@ -69,7 +69,7 @@ public class JetPsiUtilTest extends JetLiteFixture {
} }
public void testIsLocalClass() throws IOException { 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); JetClass aClass = JetPsiFactory.createClass(getProject(), text);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -49,7 +49,7 @@ public class JetCodeConformanceTest extends TestCase {
public void testParserCode() throws Exception { public void testParserCode() throws Exception {
for (File sourceFile : FileUtil.findFilesByMask(JAVA_FILE_PATTERN, new File("compiler/frontend/src/org/jetbrains/jet/lang/parsing"))) { 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); Pattern atPattern = Pattern.compile("assert.*?[^_]at.*?$", Pattern.MULTILINE);
Matcher matcher = atPattern.matcher(source); Matcher matcher = atPattern.matcher(source);
@@ -68,7 +68,7 @@ public class JetCodeConformanceTest extends TestCase {
continue; 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 if (source.contains("@author") && JAVADOC_PATTERN.matcher(source).find()) { // .contains() is invoked for optimization
filesWithAuthorJavadoc.add(sourceFile); filesWithAuthorJavadoc.add(sourceFile);
@@ -23,7 +23,7 @@ import org.jetbrains.jet.JetTestUtils
public abstract class AbstractAnnotationParameterTest : AbstractAnnotationDescriptorResolveTest() { public abstract class AbstractAnnotationParameterTest : AbstractAnnotationDescriptorResolveTest() {
fun doTest(path: String) { fun doTest(path: String) {
val fileText = FileUtil.loadFile(File(path)) val fileText = FileUtil.loadFile(File(path), true)
val packageView = getPackage(fileText) val packageView = getPackage(fileText)
val classDescriptor = AbstractAnnotationDescriptorResolveTest.getClassDescriptor(packageView, "MyClass") val classDescriptor = AbstractAnnotationDescriptorResolveTest.getClassDescriptor(packageView, "MyClass")
@@ -41,7 +41,7 @@ public class RecursiveDescriptorProcessorTest extends KotlinTestWithEnvironment
public void testRecursive() throws Exception { public void testRecursive() throws Exception {
File ktFile = new File("compiler/testData/recursiveProcessor/declarations.kt"); File ktFile = new File("compiler/testData/recursiveProcessor/declarations.kt");
File txtFile = new File("compiler/testData/recursiveProcessor/declarations.txt"); 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()); JetFile jetFile = JetTestUtils.createFile("declarations.kt", text, getEnvironment().getProject());
AnalyzeExhaust exhaust = JetTestUtils.analyzeFile(jetFile); AnalyzeExhaust exhaust = JetTestUtils.analyzeFile(jetFile);
PackageViewDescriptor testPackage = exhaust.getModuleDescriptor().getPackage(FqName.topLevel(Name.identifier("test"))); PackageViewDescriptor testPackage = exhaust.getModuleDescriptor().getPackage(FqName.topLevel(Name.identifier("test")));
@@ -80,7 +80,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
private JetScope getContextScope() throws IOException { private JetScope getContextScope() throws IOException {
// todo comments // 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); JetFile jetFile = JetPsiFactory.createFile(getProject(), text);
ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(Collections.singletonList(jetFile), getEnvironment()); ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(Collections.singletonList(jetFile), getEnvironment());
JetScope topLevelDeclarations = module.getPackage(FqName.ROOT).getMemberScope(); JetScope topLevelDeclarations = module.getPackage(FqName.ROOT).getMemberScope();
@@ -52,7 +52,7 @@ public abstract class AbstractJetQuickDocProviderTest extends LightCodeInsightFi
String info = CtrlMouseHandler.getInfo(targetElement, element); String info = CtrlMouseHandler.getInfo(targetElement, element);
File testDataFile = new File(path); File testDataFile = new File(path);
String textData = FileUtil.loadFile(testDataFile); String textData = FileUtil.loadFile(testDataFile, true);
List<String> directives = InTextDirectivesUtils.findLinesWithPrefixesRemoved(textData, "INFO:"); List<String> directives = InTextDirectivesUtils.findLinesWithPrefixesRemoved(textData, "INFO:");
if (directives.isEmpty()) { if (directives.isEmpty()) {
@@ -265,7 +265,7 @@ public abstract class AbstractJetFindUsagesTest extends LightCodeInsightFixtureT
protected <T extends PsiElement> void doTest(@NotNull String path) throws Exception { protected <T extends PsiElement> void doTest(@NotNull String path) throws Exception {
File mainFile = new File(path); File mainFile = new File(path);
final String mainFileName = mainFile.getName(); 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); final String prefix = mainFileName.substring(0, mainFileName.indexOf('.') + 1);
List<String> caretElementClassNames = InTextDirectivesUtils.findLinesWithPrefixesRemoved(mainFileText, "// PSI_ELEMENT: "); List<String> caretElementClassNames = InTextDirectivesUtils.findLinesWithPrefixesRemoved(mainFileText, "// PSI_ELEMENT: ");
@@ -105,7 +105,7 @@ public class JetTypingIndentationTest extends LightCodeInsightTestCase {
} }
public void doFileSettingNewLineTest() throws Exception { 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); SettingsConfigurator configurator = JetFormatSettingsUtil.createConfigurator(originalFileText);
@@ -48,7 +48,7 @@ public abstract class JetLightCodeInsightFixtureTestCase extends LightCodeInsigh
protected LightProjectDescriptor getProjectDescriptorFromFileDirective() { protected LightProjectDescriptor getProjectDescriptorFromFileDirective() {
if (!isAllFilesPresentInTest()) { if (!isAllFilesPresentInTest()) {
try { 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:"); List<String> withLibraryDirective = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fileText, "WITH_LIBRARY:");
if (!withLibraryDirective.isEmpty()) { if (!withLibraryDirective.isEmpty()) {
@@ -81,7 +81,7 @@ public abstract class AbstractInsertImportOnPasteTest extends JetLightCodeInsigh
myFixture.checkResultByFile(testFileName.replace(".kt", ".expected.kt")); 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); checkNoUnresolvedReferences(toFile);
} }
} }
@@ -134,7 +134,7 @@ public abstract class AbstractInsertImportOnPasteTest extends JetLightCodeInsigh
if (file.exists()) { if (file.exists()) {
if (dependencyFileName.endsWith(".java")) { if (dependencyFileName.endsWith(".java")) {
//allow test framework to put it under right directory //allow test framework to put it under right directory
myFixture.addClass(FileUtil.loadFile(file)); myFixture.addClass(FileUtil.loadFile(file, true));
} }
else { else {
myFixture.configureByFile(dependencyFileName); 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 { private void doTest(@NotNull String path, @NotNull Class<? extends StatementUpDownMover> defaultMoverClass) throws Exception {
configureByFile(path); configureByFile(path);
String fileText = FileUtil.loadFile(new File(path)); String fileText = FileUtil.loadFile(new File(path), true);
String direction = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// MOVE: "); String direction = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// MOVE: ");
boolean down = true; boolean down = true;
@@ -81,7 +81,7 @@ public abstract class AbstractSurroundWithTest extends LightCodeInsightTestCase
private void doTest(String path, Surrounder surrounder) throws Exception { private void doTest(String path, Surrounder surrounder) throws Exception {
configureByFile(path); configureByFile(path);
String fileText = FileUtil.loadFile(new File(path)); String fileText = FileUtil.loadFile(new File(path), true);
String isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// IS_APPLICABLE: "); String isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// IS_APPLICABLE: ");
if (isApplicableString != null) { if (isApplicableString != null) {
@@ -162,7 +162,7 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes
private void doTestIntention(@NotNull String path, @NotNull IntentionAction intentionAction) throws Exception { private void doTestIntention(@NotNull String path, @NotNull IntentionAction intentionAction) throws Exception {
configureByFile(path); configureByFile(path);
String fileText = FileUtil.loadFile(new File(path)); String fileText = FileUtil.loadFile(new File(path), true);
String isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// IS_APPLICABLE: "); String isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// IS_APPLICABLE: ");
boolean isApplicableExpected = isApplicableString == null || isApplicableString.equals("true"); boolean isApplicableExpected = isApplicableString == null || isApplicableString.equals("true");
@@ -71,7 +71,7 @@ public abstract class AbstractQuickFixMultiFileTest extends DaemonAnalyzerTestCa
public void run() { public void run() {
try { try {
Pair<String, Boolean> pair = LightQuickFixTestCase.parseActionHint( 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(); String text = pair.getFirst();
boolean actionShouldBeAvailable = pair.getSecond(); 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")) val action = MoveAction.valueOf(config.getString("type"))
@@ -63,7 +63,7 @@ public abstract class AbstractRenameTest : MultiFileTestCase() {
val module: Module = getModule()!!) val module: Module = getModule()!!)
public open fun doTest(path : String) { public open fun doTest(path : String) {
val fileText = FileUtil.loadFile(File(path)) val fileText = FileUtil.loadFile(File(path), true)
val jsonParser = JsonParser() val jsonParser = JsonParser()
val renameObject = jsonParser.parse(fileText) as JsonObject val renameObject = jsonParser.parse(fileText) as JsonObject
@@ -31,8 +31,8 @@ import java.io.File;
public abstract class AbstractJetPsiMatcherTest extends JetLiteFixture { public abstract class AbstractJetPsiMatcherTest extends JetLiteFixture {
public void doTestExpressions(@NotNull String path) throws Exception { public void doTestExpressions(@NotNull String path) throws Exception {
String fileText = FileUtil.loadFile(new File(path)); String fileText = FileUtil.loadFile(new File(path), true);
String fileText2 = FileUtil.loadFile(new File(path + ".2")); String fileText2 = FileUtil.loadFile(new File(path + ".2"), true);
boolean equalityExpected = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// NOT_EQUAL") == null; 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 { public void doTestTypes(@NotNull String path) throws Exception {
String fileText = FileUtil.loadFile(new File(path)); String fileText = FileUtil.loadFile(new File(path), true);
String fileText2 = FileUtil.loadFile(new File(path + ".2")); String fileText2 = FileUtil.loadFile(new File(path + ".2"), true);
boolean equalityExpected = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// NOT_EQUAL") == null; 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 { 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>(); List<String> actualModified = new ArrayList<String>();
for (Object member : actual) { for (Object member : actual) {
actualModified.add(member.toString()); actualModified.add(member.toString());
@@ -42,7 +42,7 @@ public class AnnotatedMembersSearchTest extends AbstractSearcherTest {
private void doTest() throws IOException { private void doTest() throws IOException {
myFixture.configureByFile(getFileName()); 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: "); "// ANNOTATION: ");
assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty()); assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty());
String annotationClassName = directives.get(0); String annotationClassName = directives.get(0);
@@ -38,7 +38,7 @@ public class ClassInheritorsSearchTest extends AbstractSearcherTest {
private void doTest() throws IOException { private void doTest() throws IOException {
myFixture.configureByFile(getFileName()); 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()); assertFalse("Specify CLASS directive in test file", directives.isEmpty());
String superClassName = directives.get(0); String superClassName = directives.get(0);
PsiClass psiClass = getPsiClass(superClassName); PsiClass psiClass = getPsiClass(superClassName);
@@ -49,7 +49,7 @@ public class JUnitMembersSearcherTest extends AbstractSearcherTest {
private void doJUnit3test() throws IOException { private void doJUnit3test() throws IOException {
myFixture.configureByFile(getFileName()); 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()); assertFalse("Specify CLASS directive in test file", directives.isEmpty());
String superClassName = directives.get(0); String superClassName = directives.get(0);
PsiClass psiClass = getPsiClass(superClassName); PsiClass psiClass = getPsiClass(superClassName);
@@ -58,7 +58,7 @@ public class JUnitMembersSearcherTest extends AbstractSearcherTest {
private void doJUnit4test() throws IOException { private void doJUnit4test() throws IOException {
myFixture.configureByFile(getFileName()); 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: "); "// ANNOTATION: ");
assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty()); assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty());
String annotationClassName = directives.get(0); String annotationClassName = directives.get(0);
@@ -84,12 +84,12 @@ public final class OutputPrefixPostfixTest extends SingleFileTranslationTest {
super.runFunctionOutputTest(ecmaVersions, kotlinFilename, packageName, functionName, expectedResult); super.runFunctionOutputTest(ecmaVersions, kotlinFilename, packageName, functionName, expectedResult);
for (EcmaVersion ecmaVersion : ecmaVersions) { for (EcmaVersion ecmaVersion : ecmaVersions) {
String output = FileUtil.loadFile(new File(getOutputFilePath(filename, ecmaVersion))); String output = FileUtil.loadFile(new File(getOutputFilePath(filename, ecmaVersion)), true);
if (outputPrefixFile != null) { if (outputPrefixFile != null) {
assertTrue(output.startsWith(FileUtil.loadFile(outputPrefixFile))); assertTrue(output.startsWith(FileUtil.loadFile(outputPrefixFile, true)));
} }
if (outputPostfixFile != null) { if (outputPostfixFile != null) {
assertTrue(output.endsWith(FileUtil.loadFile(outputPostfixFile))); assertTrue(output.endsWith(FileUtil.loadFile(outputPostfixFile, true)));
} }
} }
} }
@@ -96,7 +96,7 @@ public final class RhinoUtils {
@NotNull Scriptable scope) throws Exception { @NotNull Scriptable scope) throws Exception {
String result; String result;
try { try {
result = FileUtil.loadFile(new File(inputFile)); result = FileUtil.loadFile(new File(inputFile), true);
} }
catch (IOException e) { catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -224,7 +224,7 @@ public final class RhinoUtils {
return null; return null;
} }
Object[] args = {FileUtil.loadFile(new File(fileName)), JSHINT_OPTIONS}; Object[] args = {FileUtil.loadFile(new File(fileName), true), JSHINT_OPTIONS};
Function function = (Function) ScriptableObject.getProperty(scope.getParentScope(), "JSHINT"); Function function = (Function) ScriptableObject.getProperty(scope.getParentScope(), "JSHINT");
Object status = function.call(context, scope.getParentScope(), scope.getParentScope(), args); Object status = function.call(context, scope.getParentScope(), scope.getParentScope(), args);
if (!(Boolean) Context.jsToJava(status, Boolean.class)) { if (!(Boolean) Context.jsToJava(status, Boolean.class)) {
@@ -71,7 +71,7 @@ public abstract class InlineTest extends SingleFileTranslationTest {
private void checkFooBoxIsTrueAndFunctionNameIsNotReferenced(@NotNull String filename, String funName) throws Exception { private void checkFooBoxIsTrueAndFunctionNameIsNotReferenced(@NotNull String filename, String funName) throws Exception {
fooBoxTest(); fooBoxTest();
String generatedJSFilePath = getOutputFilePath(filename, EcmaVersion.defaultVersion()); String generatedJSFilePath = getOutputFilePath(filename, EcmaVersion.defaultVersion());
String outputFileText = FileUtil.loadFile(new File(generatedJSFilePath)); String outputFileText = FileUtil.loadFile(new File(generatedJSFilePath), true);
assertTrue(countOccurrences(outputFileText, funName) == 1); assertTrue(countOccurrences(outputFileText, funName) == 1);
} }
@@ -146,7 +146,7 @@ public final class TranslationUtils {
for (String libFileName : list) { for (String libFileName : list) {
try { try {
String path = root == null ? libFileName : (root + libFileName); String path = root == null ? libFileName : (root + libFileName);
String text = FileUtil.loadFile(new File(path)); String text = FileUtil.loadFile(new File(path), true);
JetFile jetFile = JetFileUtils.createJetFile(path, text, project); JetFile jetFile = JetFileUtils.createJetFile(path, text, project);
libFiles.add(jetFile); libFiles.add(jetFile);
} }