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 2009-12-06 20:15:40 +00:00
parent b77877aea8
commit c5ef494d1f
2 changed files with 40 additions and 61 deletions

View file

@ -101,8 +101,7 @@ public class IndexIncludeTest extends IndexTestBase {
try { try {
IIndexBinding[] result= fIndex.findBindings(Pattern.compile(".*included"), true, IndexFilter.ALL, NPM); IIndexBinding[] result= fIndex.findBindings(Pattern.compile(".*included"), true, IndexFilter.ALL, NPM);
assertEquals(all ? 2 : 1, result.length); assertEquals(all ? 2 : 1, result.length);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -132,8 +131,7 @@ public class IndexIncludeTest extends IndexTestBase {
result= fIndex.findBindings("testInclude_cpp".toCharArray(), IndexFilter.ALL, NPM); result= fIndex.findBindings("testInclude_cpp".toCharArray(), IndexFilter.ALL, NPM);
assertEquals(1, result.length); assertEquals(1, result.length);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -159,8 +157,7 @@ public class IndexIncludeTest extends IndexTestBase {
checkInclude(includes[0], content, "user20061107.h", false); checkInclude(includes[0], content, "user20061107.h", false);
checkInclude(includes[1], content, "system20061107.h", true); checkInclude(includes[1], content, "system20061107.h", true);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -183,8 +180,7 @@ public class IndexIncludeTest extends IndexTestBase {
assertEquals(1, includes.length); assertEquals(1, includes.length);
checkInclude(includes[0], content, "header20061107.h", false); checkInclude(includes[0], content, "header20061107.h", false);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -205,8 +201,7 @@ public class IndexIncludeTest extends IndexTestBase {
assertFalse(includes[0].isActive()); assertFalse(includes[0].isActive());
checkInclude(includes[0], content, "inactive20070213.h", false); checkInclude(includes[0], content, "inactive20070213.h", false);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -228,8 +223,7 @@ public class IndexIncludeTest extends IndexTestBase {
assertTrue(includes[0].isActive()); assertTrue(includes[0].isActive());
assertFalse(includes[0].isResolved()); assertFalse(includes[0].isResolved());
checkInclude(includes[0], content, "unresolved20070213.h", false); checkInclude(includes[0], content, "unresolved20070213.h", false);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -259,8 +253,7 @@ public class IndexIncludeTest extends IndexTestBase {
IBinding[] bindings= fIndex.findBindings("ctx_20070404x".toCharArray(), IndexFilter.ALL, NPM); IBinding[] bindings= fIndex.findBindings("ctx_20070404x".toCharArray(), IndexFilter.ALL, NPM);
assertEquals(1, bindings.length); assertEquals(1, bindings.length);
assertTrue(bindings[0] instanceof IVariable); assertTrue(bindings[0] instanceof IVariable);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
@ -277,11 +270,9 @@ public class IndexIncludeTest extends IndexTestBase {
IBinding[] bindings= fIndex.findBindings("ctx_20070404y".toCharArray(), IndexFilter.ALL, NPM); IBinding[] bindings= fIndex.findBindings("ctx_20070404y".toCharArray(), IndexFilter.ALL, NPM);
assertEquals(1, bindings.length); assertEquals(1, bindings.length);
assertTrue(bindings[0] instanceof IVariable); assertTrue(bindings[0] instanceof IVariable);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
// #define SOME_MACRO1 ok_1_220358 // #define SOME_MACRO1 ok_1_220358
@ -308,8 +299,7 @@ public class IndexIncludeTest extends IndexTestBase {
IIndexBinding[] binding= fIndex.findBindings("ok_1_220358".toCharArray(), IndexFilter.ALL_DECLARED, NPM); IIndexBinding[] binding= fIndex.findBindings("ok_1_220358".toCharArray(), IndexFilter.ALL_DECLARED, NPM);
assertEquals(1, binding.length); assertEquals(1, binding.length);
assertTrue(binding[0] instanceof IVariable); assertTrue(binding[0] instanceof IVariable);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
@ -321,13 +311,11 @@ public class IndexIncludeTest extends IndexTestBase {
IIndexBinding[] binding= fIndex.findBindings("ok_2_220358".toCharArray(), IndexFilter.ALL_DECLARED, NPM); IIndexBinding[] binding= fIndex.findBindings("ok_2_220358".toCharArray(), IndexFilter.ALL_DECLARED, NPM);
assertEquals(1, binding.length); assertEquals(1, binding.length);
assertTrue(binding[0] instanceof IVariable); assertTrue(binding[0] instanceof IVariable);
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
// #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()};
@ -355,8 +343,7 @@ public class IndexIncludeTest extends IndexTestBase {
assertEquals(s1.getFullPath().toString(), includes[0].getIncludedByLocation().getFullPath()); assertEquals(s1.getFullPath().toString(), includes[0].getIncludedByLocation().getFullPath());
assertEquals(s2.getFullPath().toString(), includes[1].getIncludedByLocation().getFullPath()); assertEquals(s2.getFullPath().toString(), includes[1].getIncludedByLocation().getFullPath());
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
@ -374,8 +361,7 @@ public class IndexIncludeTest extends IndexTestBase {
IIndexInclude context= ifile.getParsedInContext(); IIndexInclude context= ifile.getParsedInContext();
assertNotNull(context); assertNotNull(context);
assertEquals(s1.getFullPath().toString(), context.getIncludedByLocation().getFullPath()); assertEquals(s1.getFullPath().toString(), context.getIncludedByLocation().getFullPath());
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
@ -393,8 +379,7 @@ public class IndexIncludeTest extends IndexTestBase {
IIndexInclude context= ifile.getParsedInContext(); IIndexInclude context= ifile.getParsedInContext();
assertNotNull(context); assertNotNull(context);
assertEquals(s1.getFullPath().toString(), context.getIncludedByLocation().getFullPath()); assertEquals(s1.getFullPath().toString(), context.getIncludedByLocation().getFullPath());
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -500,8 +485,7 @@ public class IndexIncludeTest extends IndexTestBase {
assertFalse(includes[2].isActive()); assertFalse(includes[2].isActive());
assertFalse(includes[2].isResolved()); assertFalse(includes[2].isResolved());
assertFalse(includes[2].isSystemInclude()); assertFalse(includes[2].isSystemInclude());
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -532,8 +516,7 @@ public class IndexIncludeTest extends IndexTestBase {
assertFalse(includes[1].isActive()); assertFalse(includes[1].isActive());
assertFalse(includes[1].isResolved()); assertFalse(includes[1].isResolved());
assertTrue(includes[1].isSystemInclude()); assertTrue(includes[1].isSystemInclude());
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -568,8 +551,7 @@ public class IndexIncludeTest extends IndexTestBase {
assertFalse(includes[1].isActive()); assertFalse(includes[1].isActive());
assertFalse(includes[1].isResolved()); assertFalse(includes[1].isResolved());
assertTrue(includes[1].isSystemInclude()); assertTrue(includes[1].isSystemInclude());
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }
@ -604,8 +586,7 @@ public class IndexIncludeTest extends IndexTestBase {
assertTrue(includes[1].isActive()); assertTrue(includes[1].isActive());
assertFalse(includes[1].isResolved()); assertFalse(includes[1].isResolved());
assertFalse(includes[1].isSystemInclude()); assertFalse(includes[1].isSystemInclude());
} } finally {
finally {
fIndex.releaseReadLock(); fIndex.releaseReadLock();
} }
} }

View file

@ -161,7 +161,7 @@ public class BaseTestCase extends TestCase {
msg.append("\t" + s.getMessage()+" "); msg.append("\t" + s.getMessage()+" ");
Throwable t= s.getException(); Throwable t= s.getException();
cause= (cause==null) ? t : cause; cause= cause != null ? cause : t;
if (t != null) { if (t != null) {
msg.append(t.getMessage() != null ? t.getMessage() : t.getClass().getCanonicalName()); msg.append(t.getMessage() != null ? t.getMessage() : t.getClass().getCanonicalName());
} }
@ -170,7 +170,7 @@ public class BaseTestCase extends TestCase {
} }
} }
} }
cause= (cause==null) ? testThrowable : cause; cause= cause != null ? cause : testThrowable;
AssertionFailedError afe= new AssertionFailedError(msg.toString()); AssertionFailedError afe= new AssertionFailedError(msg.toString());
afe.initCause(cause); afe.initCause(cause);
throw afe; throw afe;
@ -202,9 +202,7 @@ public class BaseTestCase extends TestCase {
if (msg != null && msg.startsWith("Method \"" + getName() + "\"")) { if (msg != null && msg.startsWith("Method \"" + getName() + "\"")) {
result.addFailure(this, new AssertionFailedError(msg)); result.addFailure(this, new AssertionFailedError(msg));
} }
} } else if (r.errorCount() == 0 && r.failureCount() == 0) {
else if( r.errorCount() == 0 && r.failureCount() == 0 )
{
String err = "Unexpected success of " + getName(); String err = "Unexpected success of " + getName();
if (fBugnumber > 0) { if (fBugnumber > 0) {
err += ", bug #" + fBugnumber; err += ", bug #" + fBugnumber;
@ -257,8 +255,8 @@ public class BaseTestCase extends TestCase {
changed.wait(); changed.wait();
} }
} }
} catch(InterruptedException ie) { } catch (InterruptedException e) {
throw new CoreException(CCorePlugin.createStatus("Interrupted", ie)); throw new CoreException(CCorePlugin.createStatus("Interrupted", e));
} }
} }