mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
484ec88e27
commit
bcb582c6dd
3 changed files with 29 additions and 36 deletions
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.index.tests;
|
package org.eclipse.cdt.internal.index.tests;
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICProject fProject= null;
|
private ICProject fProject;
|
||||||
private IIndex fIndex= null;
|
private IIndex fIndex;
|
||||||
|
|
||||||
public IndexIncludeTest(String name) {
|
public IndexIncludeTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -61,8 +61,8 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
if (fProject == null) {
|
if (fProject == null) {
|
||||||
fProject= createProject(true, "resources/indexTests/includes");
|
fProject= createProject(true, "resources/indexTests/includes");
|
||||||
IPathEntry[] entries= new IPathEntry[] {
|
IPathEntry[] entries= new IPathEntry[] {
|
||||||
CoreModel.newIncludeEntry(fProject.getPath(),
|
CoreModel.newIncludeEntry(fProject.getPath(), null,
|
||||||
null, fProject.getResource().getLocation())};
|
fProject.getResource().getLocation()) };
|
||||||
fProject.setRawPathEntries(entries, npm());
|
fProject.setRawPathEntries(entries, npm());
|
||||||
}
|
}
|
||||||
fIndex= CCorePlugin.getIndexManager().getIndex(fProject);
|
fIndex= CCorePlugin.getIndexManager().getIndex(fProject);
|
||||||
|
@ -141,7 +141,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
// #include <system20061107.h>
|
// #include <system20061107.h>
|
||||||
public void testIncludeProperties() throws Exception {
|
public void testIncludeProperties() throws Exception {
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() };
|
||||||
String content= readTaggedComment("source20061107");
|
String content= readTaggedComment("source20061107");
|
||||||
TestSourceReader.createFile(fProject.getProject(), "user20061107.h", "");
|
TestSourceReader.createFile(fProject.getProject(), "user20061107.h", "");
|
||||||
TestSourceReader.createFile(fProject.getProject(), "system20061107.h", "");
|
TestSourceReader.createFile(fProject.getProject(), "system20061107.h", "");
|
||||||
|
@ -163,7 +163,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIncludeProperties_2() throws Exception {
|
public void testIncludeProperties_2() throws Exception {
|
||||||
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() };
|
||||||
TestSourceReader.createFile(fProject.getProject(), "header20061107.h", "");
|
TestSourceReader.createFile(fProject.getProject(), "header20061107.h", "");
|
||||||
String content = "// comment \n#include \"header20061107.h\"\n";
|
String content = "// comment \n#include \"header20061107.h\"\n";
|
||||||
IFile file= TestSourceReader.createFile(fProject.getProject(), "intermed20061107.h", content);
|
IFile file= TestSourceReader.createFile(fProject.getProject(), "intermed20061107.h", content);
|
||||||
|
@ -186,7 +186,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInactiveInclude() throws Exception {
|
public void testInactiveInclude() throws Exception {
|
||||||
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() };
|
||||||
String content = "#if 0\n#include \"inactive20070213.h\"\n#endif\n";
|
String content = "#if 0\n#include \"inactive20070213.h\"\n#endif\n";
|
||||||
IFile file= TestSourceReader.createFile(fProject.getProject(), "source20070213.cpp", content);
|
IFile file= TestSourceReader.createFile(fProject.getProject(), "source20070213.cpp", content);
|
||||||
CCorePlugin.getIndexManager().reindex(fProject);
|
CCorePlugin.getIndexManager().reindex(fProject);
|
||||||
|
@ -207,7 +207,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUnresolvedInclude() throws Exception {
|
public void testUnresolvedInclude() throws Exception {
|
||||||
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() };
|
||||||
String content = "#include \"unresolved20070213.h\"\n";
|
String content = "#include \"unresolved20070213.h\"\n";
|
||||||
IFile file= TestSourceReader.createFile(fProject.getProject(), "source20070214.cpp", content);
|
IFile file= TestSourceReader.createFile(fProject.getProject(), "source20070214.cpp", content);
|
||||||
CCorePlugin.getIndexManager().reindex(fProject);
|
CCorePlugin.getIndexManager().reindex(fProject);
|
||||||
|
@ -318,7 +318,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
|
|
||||||
// #include "resolved20070426.h"
|
// #include "resolved20070426.h"
|
||||||
public void testFixedContext() throws Exception {
|
public void testFixedContext() throws Exception {
|
||||||
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() };
|
||||||
String source= getContentsForTest(1)[0].toString();
|
String source= getContentsForTest(1)[0].toString();
|
||||||
IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070426.h", "");
|
IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070426.h", "");
|
||||||
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s1.cpp", source);
|
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s1.cpp", source);
|
||||||
|
@ -404,7 +404,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
// #include "unesolved20070427.h"
|
// #include "unesolved20070427.h"
|
||||||
public void testUpdateIncludes() throws Exception {
|
public void testUpdateIncludes() throws Exception {
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() };
|
||||||
CharSequence[] source= getContentsForTest(4);
|
CharSequence[] source= getContentsForTest(4);
|
||||||
IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070427.h", "");
|
IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070427.h", "");
|
||||||
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp",
|
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp",
|
||||||
|
@ -446,7 +446,6 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
source[0].toString() + "\nint h20070427;");
|
source[0].toString() + "\nint h20070427;");
|
||||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, s1, INDEXER_WAIT_TIME);
|
TestSourceReader.waitUntilFileIsIndexed(fIndex, s1, INDEXER_WAIT_TIME);
|
||||||
standardCheckUpdateIncludes(header, s1, "h20070427");
|
standardCheckUpdateIncludes(header, s1, "h20070427");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void standardCheckUpdateIncludes(IFile header, IFile s1, String tag) throws Exception {
|
private void standardCheckUpdateIncludes(IFile header, IFile s1, String tag) throws Exception {
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.index.tests;
|
package org.eclipse.cdt.internal.index.tests;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -129,8 +128,7 @@ public class IndexNamesTests extends BaseTestCase {
|
||||||
enclosing= enclosed[1].getEnclosingDefinition();
|
enclosing= enclosed[1].getEnclosingDefinition();
|
||||||
assertNotNull(enclosing);
|
assertNotNull(enclosing);
|
||||||
assertName("main", enclosing);
|
assertName("main", enclosing);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
fIndex.releaseReadLock();
|
fIndex.releaseReadLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,8 +221,7 @@ public class IndexNamesTests extends BaseTestCase {
|
||||||
enclosing= enclosed[2].getEnclosingDefinition();
|
enclosing= enclosed[2].getEnclosingDefinition();
|
||||||
assertNotNull(enclosing);
|
assertNotNull(enclosing);
|
||||||
assertName("func", enclosing);
|
assertName("func", enclosing);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
fIndex.releaseReadLock();
|
fIndex.releaseReadLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,8 +271,7 @@ public class IndexNamesTests extends BaseTestCase {
|
||||||
assertEquals(couldbepolymorphic[j], indexName.couldBePolymorphicMethodCall());
|
assertEquals(couldbepolymorphic[j], indexName.couldBePolymorphicMethodCall());
|
||||||
assertEquals(container[j], CPPVisitor.getQualifiedName(fIndex.findBinding(indexName))[0]);
|
assertEquals(container[j], CPPVisitor.getQualifiedName(fIndex.findBinding(indexName))[0]);
|
||||||
j++;
|
j++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
assertEquals(false, indexName.couldBePolymorphicMethodCall());
|
assertEquals(false, indexName.couldBePolymorphicMethodCall());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,7 +281,6 @@ public class IndexNamesTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// int _i, ri, wi, rwi;
|
// int _i, ri, wi, rwi;
|
||||||
// int* rp; int* wp; int* rwp;
|
// int* rp; int* wp; int* rwp;
|
||||||
// const int* cip= &ri;
|
// const int* cip= &ri;
|
||||||
|
@ -339,14 +334,12 @@ public class IndexNamesTests extends BaseTestCase {
|
||||||
assertEquals("Read access for " + msg, isRead, indexName.isReadAccess());
|
assertEquals("Read access for " + msg, isRead, indexName.isReadAccess());
|
||||||
assertEquals("Write access for " + msg, isWrite, indexName.isWriteAccess());
|
assertEquals("Write access for " + msg, isWrite, indexName.isWriteAccess());
|
||||||
j++;
|
j++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
assertEquals(false, indexName.couldBePolymorphicMethodCall());
|
assertEquals(false, indexName.couldBePolymorphicMethodCall());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertEquals(count, j);
|
assertEquals(count, j);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
fIndex.releaseReadLock();
|
fIndex.releaseReadLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests;
|
package org.eclipse.cdt.ui.tests;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
while (firstTime || System.currentTimeMillis() < endTime) {
|
while (firstTime || System.currentTimeMillis() < endTime) {
|
||||||
if (!firstTime) {
|
if (!firstTime) {
|
||||||
Thread.sleep(sleep);
|
Thread.sleep(sleep);
|
||||||
sleep= Math.min(250, sleep*2);
|
sleep= Math.min(250, sleep * 2);
|
||||||
}
|
}
|
||||||
firstTime= false;
|
firstTime= false;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
int time= (int) (endTime- System.currentTimeMillis());
|
int time= (int) (endTime - System.currentTimeMillis());
|
||||||
if (time > 0) {
|
if (time > 0) {
|
||||||
CCorePlugin.getIndexManager().joinIndexer(time, npm());
|
CCorePlugin.getIndexManager().joinIndexer(time, npm());
|
||||||
}
|
}
|
||||||
|
@ -153,10 +153,11 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void runEventQueue(int time) {
|
protected void runEventQueue(int time) {
|
||||||
final long endTime= System.currentTimeMillis()+time;
|
final long endTime= System.currentTimeMillis() + time;
|
||||||
while(true) {
|
while (true) {
|
||||||
while (Display.getCurrent().readAndDispatch());
|
while (Display.getCurrent().readAndDispatch())
|
||||||
long diff= endTime-System.currentTimeMillis();
|
;
|
||||||
|
long diff= endTime - System.currentTimeMillis();
|
||||||
if (diff <= 0) {
|
if (diff <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -169,18 +170,18 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void expandTreeItem(Tree tree, int idx) {
|
protected void expandTreeItem(Tree tree, int idx) {
|
||||||
expandTreeItem(tree, new int[] {idx});
|
expandTreeItem(tree, new int[] { idx });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void expandTreeItem(Tree tree, int idx1, int idx2) {
|
protected void expandTreeItem(Tree tree, int idx1, int idx2) {
|
||||||
expandTreeItem(tree, new int[] {idx1, idx2});
|
expandTreeItem(tree, new int[] { idx1, idx2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void expandTreeItem(Tree tree, int[] idxs) {
|
protected void expandTreeItem(Tree tree, int[] idxs) {
|
||||||
TreeItem item= tree.getItem(idxs[0]);
|
TreeItem item= tree.getItem(idxs[0]);
|
||||||
assertNotNull(item);
|
assertNotNull(item);
|
||||||
expandTreeItem(item);
|
expandTreeItem(item);
|
||||||
for (int i=1; i < idxs.length; i++) {
|
for (int i= 1; i < idxs.length; i++) {
|
||||||
item= item.getItem(idxs[i]);
|
item= item.getItem(idxs[i]);
|
||||||
assertNotNull(item);
|
assertNotNull(item);
|
||||||
expandTreeItem(item);
|
expandTreeItem(item);
|
||||||
|
@ -206,7 +207,7 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
protected void selectTreeItem(Tree tree, int[] idxs) {
|
protected void selectTreeItem(Tree tree, int[] idxs) {
|
||||||
TreeItem item= tree.getItem(idxs[0]);
|
TreeItem item= tree.getItem(idxs[0]);
|
||||||
assertNotNull(item);
|
assertNotNull(item);
|
||||||
for (int i=1; i < idxs.length; i++) {
|
for (int i= 1; i < idxs.length; i++) {
|
||||||
item= item.getItem(idxs[i]);
|
item= item.getItem(idxs[i]);
|
||||||
assertNotNull(item);
|
assertNotNull(item);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue