1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

isSymbolicLinkSupported() extracted

This commit is contained in:
Andrew Gvozdev 2011-06-02 20:05:26 +00:00
parent a05ee48bd1
commit 651418210c

View file

@ -434,16 +434,15 @@ public class ErrorParserFileMatchingTest extends TestCase {
* @throws Exception... * @throws Exception...
*/ */
public void testSymbolicLink() throws Exception { public void testSymbolicLink() throws Exception {
// do not test on systems where symbolic links are not supported
if (!ResourceHelper.isSymbolicLinkSupported())
return;
ResourceHelper.createWorkspaceFolder("OutsideFolder"); ResourceHelper.createWorkspaceFolder("OutsideFolder");
IPath realFile = ResourceHelper.createWorkspaceFile("OutsideFolder/RealFile.c"); IPath realFile = ResourceHelper.createWorkspaceFile("OutsideFolder/RealFile.c");
try { ResourceHelper.createFolder(fProject,"Folder");
ResourceHelper.createFolder(fProject,"Folder"); ResourceHelper.createSymbolicLink(fProject, "Folder/testSymbolicLink.c", realFile);
ResourceHelper.createSymbolicLink(fProject, "Folder/testSymbolicLink.c", realFile);
} catch (UnsupportedOperationException e) {
// Do not run the test on Windows system where links are not supported.
return;
}
parseOutput("testSymbolicLink.c:1:error"); parseOutput("testSymbolicLink.c:1:error");
assertEquals(1, errorList.size()); assertEquals(1, errorList.size());
@ -458,19 +457,18 @@ public class ErrorParserFileMatchingTest extends TestCase {
* @throws Exception... * @throws Exception...
*/ */
public void testDuplicateSymbolicLink() throws Exception { public void testDuplicateSymbolicLink() throws Exception {
// do not test on systems where symbolic links are not supported
if (!ResourceHelper.isSymbolicLinkSupported())
return;
ResourceHelper.createWorkspaceFolder("OutsideFolder"); ResourceHelper.createWorkspaceFolder("OutsideFolder");
IPath realFile = ResourceHelper.createWorkspaceFile("OutsideFolder/RealFile.c"); IPath realFile = ResourceHelper.createWorkspaceFile("OutsideFolder/RealFile.c");
try { ResourceHelper.createFolder(fProject,"FolderA");
ResourceHelper.createFolder(fProject,"FolderA"); ResourceHelper.createSymbolicLink(fProject, "FolderA/testDuplicateSymbolicLink.c", realFile);
ResourceHelper.createSymbolicLink(fProject, "FolderA/testDuplicateSymbolicLink.c", realFile);
ResourceHelper.createFolder(fProject,"FolderB"); ResourceHelper.createFolder(fProject,"FolderB");
ResourceHelper.createSymbolicLink(fProject, "FolderB/testDuplicateSymbolicLink.c", realFile); ResourceHelper.createSymbolicLink(fProject, "FolderB/testDuplicateSymbolicLink.c", realFile);
} catch (UnsupportedOperationException e) {
// Do not run the test on Windows system where links are not supported.
return;
}
parseOutput("testDuplicateSymbolicLink.c:1:error"); parseOutput("testDuplicateSymbolicLink.c:1:error");
assertEquals(1, errorList.size()); assertEquals(1, errorList.size());
@ -487,15 +485,14 @@ public class ErrorParserFileMatchingTest extends TestCase {
* @throws Exception... * @throws Exception...
*/ */
public void testFolderSymbolicLink() throws Exception { public void testFolderSymbolicLink() throws Exception {
// do not test on systems where symbolic links are not supported
if (!ResourceHelper.isSymbolicLinkSupported())
return;
IPath realFolder = ResourceHelper.createWorkspaceFolder("OutsideFolderForSymbolicLink"); IPath realFolder = ResourceHelper.createWorkspaceFolder("OutsideFolderForSymbolicLink");
ResourceHelper.createWorkspaceFile("OutsideFolderForSymbolicLink/testFolderSymbolicLink.c"); ResourceHelper.createWorkspaceFile("OutsideFolderForSymbolicLink/testFolderSymbolicLink.c");
try { ResourceHelper.createSymbolicLink(fProject, "FolderSymbolicLink", realFolder);
ResourceHelper.createSymbolicLink(fProject, "FolderSymbolicLink", realFolder);
} catch (UnsupportedOperationException e) {
// Do not run the test on Windows system where links are not supported.
return;
}
parseOutput("testFolderSymbolicLink.c:1:error"); parseOutput("testFolderSymbolicLink.c:1:error");
assertEquals(1, errorList.size()); assertEquals(1, errorList.size());
@ -510,16 +507,15 @@ public class ErrorParserFileMatchingTest extends TestCase {
* @throws Exception... * @throws Exception...
*/ */
public void testDuplicateFolderSymbolicLink() throws Exception { public void testDuplicateFolderSymbolicLink() throws Exception {
// do not test on systems where symbolic links are not supported
if (!ResourceHelper.isSymbolicLinkSupported())
return;
IPath realFolder = ResourceHelper.createWorkspaceFolder("OutsideFolder"); IPath realFolder = ResourceHelper.createWorkspaceFolder("OutsideFolder");
ResourceHelper.createWorkspaceFile("OutsideFolder/testDuplicateFolderSymbolicLink.c"); ResourceHelper.createWorkspaceFile("OutsideFolder/testDuplicateFolderSymbolicLink.c");
try { ResourceHelper.createSymbolicLink(fProject, "FolderSymbolicLinkA", realFolder);
ResourceHelper.createSymbolicLink(fProject, "FolderSymbolicLinkA", realFolder); ResourceHelper.createSymbolicLink(fProject, "FolderSymbolicLinkB", realFolder);
ResourceHelper.createSymbolicLink(fProject, "FolderSymbolicLinkB", realFolder);
} catch (UnsupportedOperationException e) {
// Do not run the test on Windows system where links are not supported.
return;
}
parseOutput("testDuplicateFolderSymbolicLink.c:1:error"); parseOutput("testDuplicateFolderSymbolicLink.c:1:error");
assertEquals(1, errorList.size()); assertEquals(1, errorList.size());