public void testRelativeImportIgnoringDirectories() throws IOException { myFixture.getTempDirFixture().findOrCreateDir("to_import/testdata"); myFixture.getTempDirFixture().findOrCreateDir("to_import/.name"); myFixture.getTempDirFixture().findOrCreateDir("to_import/_name"); doTest(); }
@Override protected void run(@NotNull Result result) { myFixture.getTempDirFixture().createFile("fileName.txt"); } }.execute();
@NotNull private GoCoverageAnnotator annotate(@NotNull String fileName, @NotNull String... fileNames) throws IOException { myFixture.getTempDirFixture().createFile(fileName); for (String name : fileNames) { myFixture.getTempDirFixture().createFile(name); } return annotate(parseData("coverage.out")); }
@NotNull private VirtualFile getRoot() { VirtualFile root = myFixture.getTempDirFixture().getFile(""); assertNotNull(root); return root; } }
@NotNull @Override public VirtualFile compute() throws IOException { VirtualFile workingDirectory = myFixture.getTempDirFixture().findOrCreateDir(rootName); workingDirectory.createChildData(this, rootName + ".go"); VirtualFile childDirectory = workingDirectory.createChildDirectory(this, "src"); childDirectory.createChildData(this, "nested" + Character.toUpperCase(rootName.charAt(0)) + rootName.substring(1) + ".go"); return workingDirectory; } });
private void doTestInEmptyDirectory(@NotNull String directoryName, @NotNull String newFileName, @NotNull String expectedPackage, @NotNull String expectedPackageWithTestSuffix) { try { PsiDirectory dir = myFixture.getPsiManager().findDirectory(myFixture.getTempDirFixture().findOrCreateDir(directoryName)); assertNotNull(dir); doTest(dir, newFileName, expectedPackage, expectedPackageWithTestSuffix); } catch (IOException e) { throw new RuntimeException(e); } }
@Override protected void run(@NotNull Result result) throws IOException { myFixture.getTempDirFixture().findOrCreateDir(".hidden").createChildData(this, "fileName.txt"); } }.execute();
@Override protected void run(@NotNull Result result) throws IOException { myFixture.getTempDirFixture().findOrCreateDir("glob1").createChildData(this, "fileName1.txt"); myFixture.getTempDirFixture().findOrCreateDir("glob2").createChildData(this, "fileName2.txt"); } }.execute();
public void testNegation() throws IOException { myFixture.getTempDirFixture().createFile("fileName.txt"); doTest("!fileNa<caret>", "!fileName.txt<caret>"); }
public void _testRenameMultiResolvedFile() throws IOException { myFixture.getTempDirFixture().findOrCreateDir("dir1").createChildData(this, "file.txt"); myFixture.getTempDirFixture().findOrCreateDir("dir2").createChildData(this, "file.txt"); doTest("dir*/fil<caret>e.txt", "newFile", "*/fi<caret>le.txt"); }
public void testGlobInParent() throws IOException { myFixture.getTempDirFixture().findOrCreateDir("glob1").createChildData(this, "fileName.txt"); myFixture.getTempDirFixture().findOrCreateDir("glob2").createChildData(this, "fileName.txt"); doTest("*/file<caret>Name.txt", "glob1/fileName.txt", "glob2/fileName.txt"); }
public void testNested() throws IOException { myFixture.getTempDirFixture().findOrCreateDir("dir1").createChildData(this, "fileName.txt"); myFixture.getTempDirFixture().findOrCreateDir("dir2").createChildData(this, "fileName.txt"); doTest("file<caret>Name.txt", "dir1/fileName.txt", "dir2/fileName.txt"); }
protected void doDirTest() { String testDataPath = getTestDataPath(); String testName = getTestName(false); File fromDir = new File(testDataPath + "/" + testName); if (!fromDir.isDirectory()) { throw new RuntimeException("Given file is not directory: " + fromDir); } //noinspection ConstantConditions for (File file : fromDir.listFiles()) { if (file.isDirectory()) { myFixture.copyDirectoryToProject(testName + "/" + file.getName(), file.getName()); } else { myFixture.copyFileToProject(testName + "/" + file.getName()); } } VirtualFile dirToTest = myFixture.getTempDirFixture().getFile("."); assertNotNull(dirToTest); GoModuleLibrariesService.getInstance(myFixture.getModule()).setLibraryRootUrls(dirToTest.getUrl()); doDirectoryTest(dirToTest); }
public void testInvalidRegex() throws IOException { myFixture.getTempDirFixture().findOrCreateDir("glob").createChildData(this, "fileName1.txt"); doTest("glob/fileN(<caret>.txt"); }
public void testNestedDirectory() throws IOException { myFixture.getTempDirFixture().findOrCreateDir("dir").createChildData(this, "fileName.txt"); doTest("dir/file<caret>Name.txt", "dir/fileName.txt"); }
public void testInHiddenDirectory() throws IOException { myFixture.getTempDirFixture().findOrCreateDir(".hidden").createChildData(this, "fileName.txt"); doTest(".hidden/file<caret>Name.txt", ".hidden/fileName.txt"); }
public void testRenameFile() throws IOException { myFixture.getTempDirFixture().findOrCreateDir("dir").createChildData(this, "file.txt"); doTest("*/fil<caret>e.txt", "newFile.txt", "dir/newFile.txt"); }
public void testRenameDirectory() throws IOException { myFixture.getTempDirFixture().findOrCreateDir("dir").createChildData(this, "file.txt"); doTest("di<caret>r/file.txt", "newDir", "newDir/file.txt"); }
public void testGlob() throws IOException { VirtualFile dir = myFixture.getTempDirFixture().findOrCreateDir("glob"); dir.createChildData(this, "fileName1.txt"); dir.createChildData(this, "fileName2.txt"); doTest("glob/*<caret>.txt", "glob/fileName1.txt", "glob/fileName2.txt"); }
public void testMerging() throws IOException { VirtualFile file = myFixture.getTempDirFixture().createFile(file()); GoCoverageProjectData firstData = parseData("coverage.out"); GoCoverageProjectData secondData = parseData("coverage_for_merge.out"); GoCoverageAnnotator firstAnnotator = annotate(firstData); GoCoverageAnnotator secondAnnotator = annotate(secondData); firstData.merge(secondData); GoCoverageAnnotator mergeAnnotator = annotate(firstData); assertEquals("75% statements", firstAnnotator.getFileCoverageInformationString(file)); assertEquals("33.3% statements", secondAnnotator.getFileCoverageInformationString(file)); assertEquals("80% statements", mergeAnnotator.getFileCoverageInformationString(file)); }