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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-10-02 16:52:20 -07:00
parent bd624aeb0c
commit 419eca0c3f
3 changed files with 29 additions and 36 deletions

View file

@ -48,8 +48,8 @@ public class IndexIncludeTest extends IndexTestBase {
return suite;
}
private ICProject fProject= null;
private IIndex fIndex= null;
private ICProject fProject;
private IIndex fIndex;
public IndexIncludeTest(String name) {
super(name);
@ -61,8 +61,8 @@ public class IndexIncludeTest extends IndexTestBase {
if (fProject == null) {
fProject= createProject(true, "resources/indexTests/includes");
IPathEntry[] entries= new IPathEntry[] {
CoreModel.newIncludeEntry(fProject.getPath(),
null, fProject.getResource().getLocation())};
CoreModel.newIncludeEntry(fProject.getPath(), null,
fProject.getResource().getLocation()) };
fProject.setRawPathEntries(entries, npm());
}
fIndex= CCorePlugin.getIndexManager().getIndex(fProject);
@ -141,7 +141,7 @@ public class IndexIncludeTest extends IndexTestBase {
// #include <system20061107.h>
public void testIncludeProperties() throws Exception {
waitForIndexer();
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() };
String content= readTaggedComment("source20061107");
TestSourceReader.createFile(fProject.getProject(), "user20061107.h", "");
TestSourceReader.createFile(fProject.getProject(), "system20061107.h", "");
@ -163,7 +163,7 @@ public class IndexIncludeTest extends IndexTestBase {
}
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", "");
String content = "// comment \n#include \"header20061107.h\"\n";
IFile file= TestSourceReader.createFile(fProject.getProject(), "intermed20061107.h", content);
@ -186,7 +186,7 @@ public class IndexIncludeTest extends IndexTestBase {
}
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";
IFile file= TestSourceReader.createFile(fProject.getProject(), "source20070213.cpp", content);
CCorePlugin.getIndexManager().reindex(fProject);
@ -207,7 +207,7 @@ public class IndexIncludeTest extends IndexTestBase {
}
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";
IFile file= TestSourceReader.createFile(fProject.getProject(), "source20070214.cpp", content);
CCorePlugin.getIndexManager().reindex(fProject);
@ -318,7 +318,7 @@ public class IndexIncludeTest extends IndexTestBase {
// #include "resolved20070426.h"
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();
IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070426.h", "");
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s1.cpp", source);
@ -404,7 +404,7 @@ public class IndexIncludeTest extends IndexTestBase {
// #include "unesolved20070427.h"
public void testUpdateIncludes() throws Exception {
waitForIndexer();
TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()};
TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() };
CharSequence[] source= getContentsForTest(4);
IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070427.h", "");
IFile s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp",
@ -446,7 +446,6 @@ public class IndexIncludeTest extends IndexTestBase {
source[0].toString() + "\nint h20070427;");
TestSourceReader.waitUntilFileIsIndexed(fIndex, s1, INDEXER_WAIT_TIME);
standardCheckUpdateIncludes(header, s1, "h20070427");
}
private void standardCheckUpdateIncludes(IFile header, IFile s1, String tag) throws Exception {

View file

@ -8,7 +8,6 @@
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.index.tests;
import java.io.IOException;
@ -129,8 +128,7 @@ public class IndexNamesTests extends BaseTestCase {
enclosing= enclosed[1].getEnclosingDefinition();
assertNotNull(enclosing);
assertName("main", enclosing);
}
finally {
} finally {
fIndex.releaseReadLock();
}
}
@ -223,8 +221,7 @@ public class IndexNamesTests extends BaseTestCase {
enclosing= enclosed[2].getEnclosingDefinition();
assertNotNull(enclosing);
assertName("func", enclosing);
}
finally {
} finally {
fIndex.releaseReadLock();
}
}
@ -274,8 +271,7 @@ public class IndexNamesTests extends BaseTestCase {
assertEquals(couldbepolymorphic[j], indexName.couldBePolymorphicMethodCall());
assertEquals(container[j], CPPVisitor.getQualifiedName(fIndex.findBinding(indexName))[0]);
j++;
}
else {
} else {
assertEquals(false, indexName.couldBePolymorphicMethodCall());
}
}
@ -285,7 +281,6 @@ public class IndexNamesTests extends BaseTestCase {
}
}
// int _i, ri, wi, rwi;
// int* rp; int* wp; int* rwp;
// const int* cip= &ri;
@ -339,14 +334,12 @@ public class IndexNamesTests extends BaseTestCase {
assertEquals("Read access for " + msg, isRead, indexName.isReadAccess());
assertEquals("Write access for " + msg, isWrite, indexName.isWriteAccess());
j++;
}
else {
} else {
assertEquals(false, indexName.couldBePolymorphicMethodCall());
}
}
assertEquals(count, j);
}
finally {
} finally {
fIndex.releaseReadLock();
}
}

View file

@ -125,7 +125,7 @@ public class BaseUITestCase extends BaseTestCase {
while (firstTime || System.currentTimeMillis() < endTime) {
if (!firstTime) {
Thread.sleep(sleep);
sleep= Math.min(250, sleep*2);
sleep= Math.min(250, sleep * 2);
}
firstTime= false;
@ -143,7 +143,7 @@ public class BaseUITestCase extends BaseTestCase {
}
} finally {
index.releaseReadLock();
int time= (int) (endTime- System.currentTimeMillis());
int time= (int) (endTime - System.currentTimeMillis());
if (time > 0) {
CCorePlugin.getIndexManager().joinIndexer(time, npm());
}
@ -153,10 +153,11 @@ public class BaseUITestCase extends BaseTestCase {
}
protected void runEventQueue(int time) {
final long endTime= System.currentTimeMillis()+time;
while(true) {
while (Display.getCurrent().readAndDispatch());
long diff= endTime-System.currentTimeMillis();
final long endTime= System.currentTimeMillis() + time;
while (true) {
while (Display.getCurrent().readAndDispatch())
;
long diff= endTime - System.currentTimeMillis();
if (diff <= 0) {
break;
}
@ -169,18 +170,18 @@ public class BaseUITestCase extends BaseTestCase {
}
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) {
expandTreeItem(tree, new int[] {idx1, idx2});
expandTreeItem(tree, new int[] { idx1, idx2 });
}
protected void expandTreeItem(Tree tree, int[] idxs) {
TreeItem item= tree.getItem(idxs[0]);
assertNotNull(item);
expandTreeItem(item);
for (int i=1; i < idxs.length; i++) {
for (int i= 1; i < idxs.length; i++) {
item= item.getItem(idxs[i]);
assertNotNull(item);
expandTreeItem(item);
@ -206,7 +207,7 @@ public class BaseUITestCase extends BaseTestCase {
protected void selectTreeItem(Tree tree, int[] idxs) {
TreeItem item= tree.getItem(idxs[0]);
assertNotNull(item);
for (int i=1; i < idxs.length; i++) {
for (int i= 1; i < idxs.length; i++) {
item= item.getItem(idxs[i]);
assertNotNull(item);
}