diff options
author | Sergey Prigogin | 2012-04-29 00:37:09 +0000 |
---|---|---|
committer | Sergey Prigogin | 2012-04-29 00:37:09 +0000 |
commit | db6b4cf5accf49930cb20e65209efad0d77b21ac (patch) | |
tree | 0122b49c729afdfc35955dabbfbbe64bacc7027c | |
parent | 82fb03e1a065fc13a9dfa7dd2baa150beacbb985 (diff) | |
download | org.eclipse.cdt-db6b4cf5accf49930cb20e65209efad0d77b21ac.tar.gz org.eclipse.cdt-db6b4cf5accf49930cb20e65209efad0d77b21ac.tar.xz org.eclipse.cdt-db6b4cf5accf49930cb20e65209efad0d77b21ac.zip |
Cosmetics.
2 files changed, 42 insertions, 55 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/CaseBreakCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/CaseBreakCheckerTest.java index 92799531245..4b17697bded 100644 --- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/CaseBreakCheckerTest.java +++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/CaseBreakCheckerTest.java @@ -16,14 +16,9 @@ import org.eclipse.cdt.codan.core.test.CheckerTestCase; import org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker; /** - * Test for {@link#CaseBreakChecker} class + * Test for {@link CaseBreakChecker} class */ public class CaseBreakCheckerTest extends CheckerTestCase { - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.codan.core.test.CodanTestCase#setUp() - */ @Override public void setUp() throws Exception { super.setUp(); @@ -34,7 +29,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a; - // switch( a ) { + // switch (a) { // case 1: // } // } @@ -45,7 +40,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a; - // switch( a ) { + // switch (a) { // default: // } // } @@ -56,7 +51,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // b = 2; // } @@ -68,7 +63,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // case 2: // b = 2; @@ -83,7 +78,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a; - // switch( a ) { + // switch (a) { // case 1: // break; // } @@ -95,7 +90,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a; - // switch( a ) { + // switch (a) { // case 1: // return; // } @@ -107,7 +102,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(int a) { // while (a--) - // switch( a ) { + // switch (a) { // case 1: // continue; // } @@ -119,7 +114,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(int a) { // - // switch( a ) { + // switch (a) { // case 1: // throw 1; // } @@ -131,7 +126,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // b = 2; // break; @@ -144,7 +139,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // break; // case 2: @@ -159,7 +154,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a; - // switch( a ) { + // switch (a) { // case 1: // /* no break */ // } @@ -170,7 +165,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { } // void foo(int a, int b) { - // switch( a ) { + // switch (a) { // case 1: // switch (b) { // case 2: @@ -187,7 +182,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // b = 2; // /* no break */ @@ -200,7 +195,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // /* no break */ // case 2: @@ -214,7 +209,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // b = 2; // /* no break */ @@ -228,7 +223,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // b = 2; // /* no break */ @@ -259,14 +254,14 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: //err // // lolo // case 2: //err // case 3://err // } // - // switch( a ) { + // switch (a) { // case 1: // b = 2; // err // // lolo @@ -279,7 +274,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // case 6: // err // } // - // switch( a ) { + // switch (a) { // case 1: // b = 2; // err // // lolo @@ -301,7 +296,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // b = 2;//err // } // - // switch( a ) { + // switch (a) { // case 1: // b = 2; // err // // lolo @@ -319,7 +314,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // b = 2; // // lolo @@ -349,7 +344,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 0: // switch( b ) { // case 2: // err @@ -385,7 +380,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // b = 2; // } @@ -399,7 +394,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a, b; - // switch( a ) { + // switch (a) { // case 1: // case 2: // b = 2; @@ -417,7 +412,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a; - // switch( a ) { + // switch (a) { // case 1: // } // } @@ -443,7 +438,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { } // void foo(int a) { - // switch( a ) { + // switch (a) { // case 1: // while (a--) // break; // err @@ -459,7 +454,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { } // void foo(int a) { - // switch( a ) { + // switch (a) { // case 1: { // break; // } @@ -476,7 +471,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { // void foo(void) { // int a; - // switch( a ) { + // switch (a) { // case 2: // break; // case 1: @@ -494,7 +489,7 @@ public class CaseBreakCheckerTest extends CheckerTestCase { } // void foo(int a) { - // switch( a ) { + // switch (a) { // case 2: // if (a*2<10) // return; diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CheckerTestCase.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CheckerTestCase.java index 75b3f6a2667..acf0b7250d8 100644 --- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CheckerTestCase.java +++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CheckerTestCase.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Alena Laskavaia - initial API and implementation - * Marc-Andre Laperle + * Alena Laskavaia - initial API and implementation + * Marc-Andre Laperle *******************************************************************************/ package org.eclipse.cdt.codan.core.test; @@ -55,7 +55,7 @@ public class CheckerTestCase extends CodanTestCase { for (Object i : errLines) { checkErrorLine((Integer) i); } - assertEquals("Expected number of errors "+errLines.size(),errLines.size(), markers.length); + assertEquals("Expected number of errors " + errLines.size(),errLines.size(), markers.length); } public IMarker checkErrorLine(int i, String problemId) { @@ -90,7 +90,7 @@ public class CheckerTestCase extends CodanTestCase { break; } } - assertEquals("Error on line "+expectedLine+" is not found",Integer.valueOf(expectedLine), line); + assertEquals("Error on line " + expectedLine + " is not found", Integer.valueOf(expectedLine), line); if (file != null) assertEquals(file.getName(), mfile); assertTrue(found); @@ -120,18 +120,13 @@ public class CheckerTestCase extends CodanTestCase { } public void checkNoErrors() { - if (markers == null || markers.length == 0) { - // all good - } else { + if (markers != null && markers.length > 0) { IMarker m = markers[0]; - fail("Found " + markers.length + " errors but should not. First " + CodanProblemMarker.getProblemId(m) + " at line " - + getLine(m)); + fail("Found " + markers.length + " errors but should not. First " + + CodanProblemMarker.getProblemId(m) + " at line " + getLine(m)); } } - /** - * - */ public void runOnProject() { try { indexFiles(); @@ -151,9 +146,6 @@ public class CheckerTestCase extends CodanTestCase { runCodan(); } - /** - * - */ protected void runCodan() { CodanRuntime.getInstance().getBuilder().processResource(cproject.getProject(), new NullProgressMonitor()); try { @@ -169,8 +161,9 @@ public class CheckerTestCase extends CodanTestCase { * @return */ protected IProblemPreference getPreference(String problemId, String paramId) { - IProblem problem = CodanRuntime.getInstance().getCheckersRegistry().getResourceProfile(cproject.getResource()) - .findProblem(problemId); + IProblemProfile resourceProfile = + CodanRuntime.getInstance().getCheckersRegistry().getResourceProfile(cproject.getResource()); + IProblem problem = resourceProfile.findProblem(problemId); IProblemPreference pref = ((MapProblemPreference) problem.getPreference()).getChildDescriptor(paramId); return pref; } @@ -219,8 +212,8 @@ public class CheckerTestCase extends CodanTestCase { String pid = ids[j]; if (p.getId().equals(pid)) { enabled = true; - // Force the launch mode to FULL_BUILD to make sure we can test the problem even if by default it - // is not set to run on FULL_BUILD + // Force the launch mode to FULL_BUILD to make sure we can test the problem even + // if by default it is not set to run on FULL_BUILD. IProblemPreference preference = p.getPreference(); if (preference instanceof RootProblemPreference) { RootProblemPreference rootProblemPreference = (RootProblemPreference) preference; @@ -232,6 +225,5 @@ public class CheckerTestCase extends CodanTestCase { ((CodanProblem) p).setEnabled(enabled); } CodanRuntime.getInstance().getCheckersRegistry().updateProfile(cproject.getProject(), profile); - return; } } |