Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2011-08-08 19:27:41 -0400
committerSergey Prigogin2011-08-08 19:27:41 -0400
commit13d4a94d42c553d5459552c638521de29cad2681 (patch)
tree6cc113bebc65297b31051f405fb67db93a4e4617 /codan/org.eclipse.cdt.codan.core.test
parent389a1ff92bf793fbe968aa050db408b6b9e89d42 (diff)
downloadorg.eclipse.cdt-13d4a94d42c553d5459552c638521de29cad2681.tar.gz
org.eclipse.cdt-13d4a94d42c553d5459552c638521de29cad2681.tar.xz
org.eclipse.cdt-13d4a94d42c553d5459552c638521de29cad2681.zip
Use StringBuilder instead of StringBuffer.
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.test')
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java8
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanFastCxxAstTestCase.java9
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java19
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/SuggestedParenthesisQuickFixTest.java14
4 files changed, 26 insertions, 24 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java
index 25596bf939..3848fedd71 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/StatementHasNoEffectCheckerTest.java
@@ -10,14 +10,14 @@
*******************************************************************************/
package org.eclipse.cdt.codan.core.internal.checkers;
-import java.io.File;
-import java.io.IOException;
-
import org.eclipse.cdt.codan.core.param.IProblemPreference;
import org.eclipse.cdt.codan.core.test.CheckerTestCase;
import org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectChecker;
import org.eclipse.core.resources.IMarker;
+import java.io.File;
+import java.io.IOException;
+
/**
* Test for {@see StatementHasNoEffectChecker} class
*
@@ -107,7 +107,7 @@ public class StatementHasNoEffectCheckerTest extends CheckerTestCase {
// }
/* this test is using two files */
public void test2FilesUnaryExpression() throws IOException {
- StringBuffer[] code = getContents(2);
+ CharSequence[] code = getContents(2);
File f1 = loadcode(code[0].toString());
File f2 = loadcode(code[1].toString());
runOnProject();
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanFastCxxAstTestCase.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanFastCxxAstTestCase.java
index 30b2d3e1e4..fda1349b05 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanFastCxxAstTestCase.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanFastCxxAstTestCase.java
@@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.codan.core.test;
-import java.io.IOException;
-import java.util.ArrayList;
-
import junit.framework.TestCase;
import org.eclipse.cdt.codan.core.CodanRuntime;
@@ -45,6 +42,9 @@ import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
+import java.io.IOException;
+import java.util.ArrayList;
+
/**
* TODO: add description
*/
@@ -56,7 +56,7 @@ public abstract class CodanFastCxxAstTestCase extends TestCase {
return getContents(1)[0].toString();
}
- protected StringBuffer[] getContents(int sections) {
+ protected StringBuilder[] getContents(int sections) {
try {
CodanCoreTestActivator plugin = CodanCoreTestActivator.getDefault();
return TestSourceReader.getContentsForTest(plugin == null ? null : plugin.getBundle(), "src", getClass(), getName(), sections);
@@ -69,6 +69,7 @@ public abstract class CodanFastCxxAstTestCase extends TestCase {
public boolean isCpp() {
return false;
}
+
private static final NullLogService NULL_LOG = new NullLogService();
/**
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java
index 120883430a..76b3397fd6 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java
@@ -10,12 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.codan.core.test;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.model.CModelException;
@@ -36,6 +30,12 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+
/**
* TODO: add description
*/
@@ -64,7 +64,7 @@ public class CodanTestCase extends BaseTestCase {
/**
* Override for c++ (i.e. at least one c++ test)
- *
+ *
* @return is c++ tests
*/
public boolean isCpp() {
@@ -170,9 +170,10 @@ public class CodanTestCase extends BaseTestCase {
return getContents(1)[0].toString();
}
- protected StringBuffer[] getContents(int sections) {
+ protected StringBuilder[] getContents(int sections) {
try {
- return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(), getClass(), getName(), sections);
+ return TestSourceReader.getContentsForTest(getPlugin().getBundle(), getSourcePrefix(),
+ getClass(), getName(), sections);
} catch (IOException e) {
fail(e.getMessage());
return null;
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/SuggestedParenthesisQuickFixTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/SuggestedParenthesisQuickFixTest.java
index 0d47fe67ad..e06baa2f08 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/SuggestedParenthesisQuickFixTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/SuggestedParenthesisQuickFixTest.java
@@ -10,16 +10,16 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
import org.eclipse.cdt.codan.core.test.TestUtils;
import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
import org.eclipse.cdt.internal.ui.util.EditorUtility;
import org.eclipse.core.runtime.CoreException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
/**
* Test for quick fix for suggested parenthesis
*/
@@ -32,7 +32,7 @@ public class SuggestedParenthesisQuickFixTest extends QuickFixTestCase {
// main() {
// int a=1,b=3;
- // if (b+a && a>b || b-a) b--; // error here
+ // if (b+a && a>b || b-a) b--; // error here
// }
public void testSimple() throws IOException, CoreException {
loadcode(getAboveComment());
@@ -53,7 +53,7 @@ public class SuggestedParenthesisQuickFixTest extends QuickFixTestCase {
* quick fix is not called
*/
public void test2FilesExample() throws FileNotFoundException, IOException {
- StringBuffer[] code = getContents(2);
+ CharSequence[] code = getContents(2);
File f1 = loadcode(code[0].toString());
File f2 = loadcode(code[1].toString());
// lets pretend marker is found in main.c but fixes go in both files,

Back to the top