@NotNull protected static String loadText(@NotNull VirtualFile file) { try { return StringUtil.convertLineSeparators(VfsUtilCore.loadText(file)); } catch (IOException e) { throw new RuntimeException(e); } }
@NotNull protected static String loadText(@NotNull VirtualFile file) { try { return StringUtil.convertLineSeparators(VfsUtilCore.loadText(file)); } catch (IOException e) { throw new RuntimeException(e); } }
private void doTest() { try { String text = FileUtil.loadFile(new File("./" + PATH + "/" + getTestName(true) + ".go"), CharsetToolkit.UTF8); String actual = printTokens(StringUtil.convertLineSeparators(text.trim()), 0); assertSameLinesWithFile(new File(PATH + "/" + getTestName(true) + ".txt").getAbsolutePath(), actual); } catch (IOException e) { throw new RuntimeException(e); } }
private void doTest() { try { String text = FileUtil.loadFile(new File("./" + PATH + "/" + getTestName(true) + ".s")); String actual = printTokens(StringUtil.convertLineSeparators(text.trim()), 0); assertSameLinesWithFile(new File(PATH + "/" + getTestName(true) + ".txt").getAbsolutePath(), actual); } catch (IOException e) { throw new RuntimeException(e); } }
private void doTestFile(@NotNull File sourceFile) { try { String text = FileUtil.loadFile(sourceFile, CharsetToolkit.UTF8); String actual = printTokens(StringUtil.convertLineSeparators(text.trim()), 0); String relativePath = sourceFile.getPath().replace(getTestDataDirectoryPath(), EMPTY_STRING); String pathname = (getExpectedResultDirectoryPath() + relativePath).replace(".bal", "") + ".txt"; File expectedResultFile = new File(pathname); assertSameLinesWithFile(expectedResultFile.getAbsolutePath(), actual); } catch (IOException e) { throw new RuntimeException(e); } }
private void doOverwrite(File resource) { try { String text = FileUtil.loadFile(resource, CharsetToolkit.UTF8); String relativePath = resource.getPath().replace(getTestDataDirectoryPath(), EMPTY_STRING); String actual = printTokens(StringUtil.convertLineSeparators(text.trim()), 0); String pathname = (getExpectedResultDirectoryPath() + relativePath).replace(".bal", "") + ".txt"; File expectedResultFile = new File(pathname); VfsTestUtil.overwriteTestData(expectedResultFile.toString(), actual); } catch (IOException e) { throw new RuntimeException(e); } }
private String doLoadFile(final String myFullDataPath, final String name) throws IOException, URISyntaxException { final URI resource; try { resource = this.getClass().getClassLoader().getResource(String.format("%s/%s", myFullDataPath, name)).toURI(); } catch (final NullPointerException e) { throw new IOException(e); } String text = FileUtil.loadFile(new File(resource), CharsetToolkit.UTF8).trim(); text = StringUtil.convertLineSeparators(text); return text; }
return StringUtil.convertLineSeparators(out.toString());
protected PsiFile addFile(@TestDataFile @NonNls String filePath, @Nullable VirtualFile parentDir) throws Exception { final String fullPath = getTestDataPath() + filePath; final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/')); assertNotNull("file " + filePath + " not found", vFile); String fileText = StringUtil.convertLineSeparators(VfsUtil.loadText(vFile)); return createFile(myModule, parentDir, vFile.getName(), fileText); } }
for (final File file : getTestDataFiles()) { String text = FileUtil.loadFile(file, CharsetToolkit.UTF8); text = StringUtil.convertLineSeparators(text); final int referencedOffset = text.indexOf("<ref>"); text = text.replace("<ref>", "");