public String loadTestDataFile(@TestDataFile String path) throws IOException { return BashTestUtils.loadTestCaseFile(this, path); } }
protected String loadFile(@NotNull @NonNls @TestDataFile String name) throws IOException { String adjustedName = myFileExt.isEmpty() ? name.replace(".", "") : name.replace("." + myFileExt, ".code"); return FileUtil.loadFile(new File(myFullDataPath, adjustedName), CharsetToolkit.UTF8, true).trim(); }
@NotNull public static String loadTestCaseFile(BashTestCase testCase, @TestDataFile String path) throws IOException { return FileUtil.loadFile(new File(testCase.getTestDataPath(), path.replace('/', File.separatorChar)), "UTF-8"); }
protected void assertPsiTree(@NotNull String content, @NotNull @TestDataFile String filePath) throws IOException { PsiFile psiFile = myFixture.configureByText(BashFileType.BASH_FILE_TYPE, content); BashTestUtils.assertPsiTreeByFile(this, psiFile, filePath); }
/** * Loads the test data file from the right place. */ protected String loadFile(@NonNls @TestDataFile final String name) throws IOException, URISyntaxException { return doLoadFile(srcPath, name); }
protected PsiFile addFile(@TestDataFile @NonNls String filePath) throws Exception { return addFile(filePath, myFile != null ? myFile.getVirtualFile().getParent() : null); }
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); } }
@Override protected void checkResult(@NonNls @TestDataFile final String targetDataName, final PsiFile file) throws IOException { doCheckResult(myFullDataPath, file, checkAllPsiRoots(), "expected" + File.separator + targetDataName, skipSpaces(), includeRanges()); /* Re-enable if we return to parser-helper. String phPath = ExecUtil.locateExecutableByGuessing("parser-helper"); if (phPath != null && !phPath.isEmpty()) { String expectedFile = myFullDataPath + File.separator + "expectedJson" + File.separator + targetDataName + ".txt"; assertSameLinesWithFile(expectedFile, jsonParser.getJson(file.getText(), phPath)); } else { assertEquals(true, false); // Always false. } */ }