Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferguson2007-02-27 17:39:46 +0000
committerAndrew Ferguson2007-02-27 17:39:46 +0000
commit6936ef3514ddbb8000d369cc54deae6e8c3fcbc9 (patch)
tree499dedaac84e9d4609a49bcd04e0d7217fcbeb27
parentfc38a2a891db2ba344504270185f0959b84ccf95 (diff)
downloadorg.eclipse.cdt-6936ef3514ddbb8000d369cc54deae6e8c3fcbc9.tar.gz
org.eclipse.cdt-6936ef3514ddbb8000d369cc54deae6e8c3fcbc9.tar.xz
org.eclipse.cdt-6936ef3514ddbb8000d369cc54deae6e8c3fcbc9.zip
add a further case
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java
index d777e5cf43c..19f538fed76 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java
@@ -37,6 +37,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -48,6 +49,7 @@ public class IndexLocationTest extends BaseTestCase {
ICProject cproject, emptyCProject;
File movedLocation;
File externalHeader;
+ IFolder linkedFolder;
public static Test suite() {
return suite(IndexLocationTest.class);
@@ -55,6 +57,8 @@ public class IndexLocationTest extends BaseTestCase {
protected void setUp() throws Exception {
cproject= CProjectHelper.createCProject("LocationTests", "bin", IPDOMManager.ID_NO_INDEXER);
+ linkedFolder= cproject.getProject().getFolder("linkedFolder");
+
emptyCProject= CProjectHelper.createCProject("Empty", "bin", IPDOMManager.ID_NO_INDEXER);
Bundle b = CTestPlugin.getDefault().getBundle();
@@ -235,4 +239,33 @@ public class IndexLocationTest extends BaseTestCase {
assertEquals(URIUtil.toURI("c:/foo/bar/"+paths[i]).normalize(), ifl2.getURI());
}
}
+
+ public void testURLC_RCRLC_Interaction3() throws Exception {
+ String[] paths = new String[] {
+ "a b c/d/e f/g.h",
+ "a \\b /c.d",
+ "/a b c/d-e/f.g"
+ };
+ String[] expectedFullPaths = new String[] {
+ linkedFolder.getFullPath()+"/a b c/d/e f/g.h",
+ linkedFolder.getFullPath()+"/a /b /c.d",
+ linkedFolder.getFullPath()+"/a b c/d-e/f.g"
+ };
+ // loc -project-> raw -uri-> loc
+ for(int i=0; i<paths.length; i++) {
+ IFile file= linkedFolder.getFile(paths[i]);
+ IIndexFileLocation ifl1= IndexLocationFactory.getWorkspaceIFL(file);
+ ResourceContainerRelativeLocationConverter prlc= new ResourceContainerRelativeLocationConverter(linkedFolder);
+ String r1= prlc.toInternalFormat(ifl1);
+ assertNotNull(r1);
+ URI base = URIUtil.toURI("c:/foo/bar/");
+ URIRelativeLocationConverter c1 = new URIRelativeLocationConverter(base);
+ IIndexFileLocation ifl2= c1.fromInternalFormat(r1);
+ assertNotNull(ifl2);
+ assertEquals(expectedFullPaths[i], ifl1.getFullPath());
+ assertNull(ifl2.getFullPath());
+ assertEquals(linkedFolder.getFile(paths[i]).getLocationURI(), ifl1.getURI());
+ assertEquals(URIUtil.toURI("c:/foo/bar/"+paths[i]).normalize(), ifl2.getURI());
+ }
+ }
} \ No newline at end of file

Back to the top