Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2012-04-04 14:11:57 -0400
committerSergey Prigogin2012-04-04 20:25:07 -0400
commit710e3589316e377cb77d5e3c2297a64622a25680 (patch)
tree2cbde30383179512fa9144a0aee29d4b376cd817 /core/org.eclipse.cdt.core.tests
parentffc583c84dff1622b5a42b1efddb7ae6be224431 (diff)
downloadorg.eclipse.cdt-710e3589316e377cb77d5e3c2297a64622a25680.tar.gz
org.eclipse.cdt-710e3589316e377cb77d5e3c2297a64622a25680.tar.xz
org.eclipse.cdt-710e3589316e377cb77d5e3c2297a64622a25680.zip
Cosmetics.
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java26
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java24
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/ArrayModifierTest.java27
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ArrayModifierTest.java28
4 files changed, 51 insertions, 54 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java
index eabbbc053e..33bfc7c7f1 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
* Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator;
@@ -51,7 +51,7 @@ public abstract class ChangeGeneratorTest extends BaseTestFramework {
@Override
public void runTest() throws Exception {
final ASTModificationStore modStore = new ASTModificationStore();
- IFile testFile = importFile("source.h", source); //$NON-NLS-1$
+ IFile testFile = importFile("source.h", source); //$NON-NLS-1$
ASTVisitor visitor = createModificator(modStore);
@@ -63,15 +63,15 @@ public abstract class ChangeGeneratorTest extends BaseTestFramework {
assertTrue("The indexing operation of the test CProject has not finished jet. This should not happen...", joined);
IASTTranslationUnit unit = CoreModelUtil.findTranslationUnit(testFile).getAST();
- final ChangeGenerator changeGenerator = new ChangeGenerator(modStore,
- ASTCommenter.getCommentedNodeMap(unit));
+ final ChangeGenerator changeGenerator =
+ new ChangeGenerator(modStore, ASTCommenter.getCommentedNodeMap(unit));
unit.accept(visitor);
changeGenerator.generateChange(unit);
Document doc = new Document(source);
- for (Change curChange : ((CompositeChange) changeGenerator.getChange()).getChildren()) {
- if (curChange instanceof TextFileChange) {
- TextFileChange textChange = (TextFileChange) curChange;
+ for (Change change : ((CompositeChange) changeGenerator.getChange()).getChildren()) {
+ if (change instanceof TextFileChange) {
+ TextFileChange textChange = (TextFileChange) change;
textChange.getEdit().apply(doc);
}
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java
index 70289c4204..e02fd1869b 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java
@@ -1,13 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Institute for Software (IFS)- initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Institute for Software (IFS)- initial API and implementation
******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
@@ -41,7 +41,7 @@ public class AddDeclarationBug extends ChangeGeneratorTest {
super("AddDeclarationBug");
}
- public static Test suite() {
+ public static Test suite() {
return new AddDeclarationBug();
}
@@ -64,11 +64,11 @@ public class AddDeclarationBug extends ChangeGeneratorTest {
if (declSpec instanceof ICPPASTCompositeTypeSpecifier) {
ICPPASTCompositeTypeSpecifier classNode = (ICPPASTCompositeTypeSpecifier) declSpec;
IASTSimpleDeclaration newDecl = new CPPASTSimpleDeclaration();
-
+
IASTSimpleDeclSpecifier returnTyp = new CPPASTSimpleDeclSpecifier();
returnTyp.setType(IASTSimpleDeclSpecifier.t_int);
newDecl.setDeclSpecifier(returnTyp);
-
+
IASTStandardFunctionDeclarator declarator = new CPPASTFunctionDeclarator(
new CPPASTName("exp".toCharArray())); //$NON-NLS-1$
IASTSimpleDeclSpecifier paramTyp = new CPPASTSimpleDeclSpecifier();
@@ -77,7 +77,7 @@ public class AddDeclarationBug extends ChangeGeneratorTest {
ICPPASTParameterDeclaration param = new CPPASTParameterDeclaration(paramTyp, decl);
declarator.addParameterDeclaration(param);
newDecl.addDeclarator(declarator);
-
+
ASTModification mod = new ASTModification(ModificationKind.APPEND_CHILD, classNode,
newDecl, null);
modStore.storeModification(null, mod);
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/ArrayModifierTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/ArrayModifierTest.java
index a772a7c4a2..1894869763 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/ArrayModifierTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/ArrayModifierTest.java
@@ -1,26 +1,26 @@
/*******************************************************************************
- * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Institute for Software - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.remove;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
-import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
+import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
public class ArrayModifierTest extends ChangeGeneratorTest {
@@ -40,18 +40,17 @@ public class ArrayModifierTest extends ChangeGeneratorTest {
}
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitDeclarators = true;
}
-
+
@Override
public int visit(IASTDeclarator declarator) {
if (declarator instanceof IASTArrayDeclarator) {
IASTArrayDeclarator arrayDeclarator = (IASTArrayDeclarator)declarator;
-
+
IASTArrayModifier[] modifiers = arrayDeclarator.getArrayModifiers();
ASTModification modification = new ASTModification(ModificationKind.REPLACE, modifiers[0], null, null);
modStore.storeModification(null, modification);
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ArrayModifierTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ArrayModifierTest.java
index f973cbcf8d..43b63c6a60 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ArrayModifierTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ArrayModifierTest.java
@@ -1,29 +1,29 @@
/*******************************************************************************
- * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Institute for Software - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayModifier;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
-import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
+import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
public class ArrayModifierTest extends ChangeGeneratorTest {
@@ -42,22 +42,20 @@ public class ArrayModifierTest extends ChangeGeneratorTest {
return new ArrayModifierTest();
}
-
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitDeclarators = true;
}
-
+
@Override
public int visit(IASTDeclarator declarator) {
if (declarator instanceof IASTArrayDeclarator) {
IASTArrayDeclarator arrayDeclarator = (IASTArrayDeclarator)declarator;
IASTArrayModifier[] modifiers = arrayDeclarator.getArrayModifiers();
IASTArrayModifier newModifier = new CPPASTArrayModifier();
- IASTExpression expr = new CPPASTLiteralExpression(0, "15"); //$NON-NLS-1$
+ IASTExpression expr = new CPPASTLiteralExpression(0, "15".toCharArray()); //$NON-NLS-1$
newModifier.setConstantExpression(expr);
ASTModification modification = new ASTModification(ModificationKind.REPLACE, modifiers[0], newModifier, null);
modStore.storeModification(null, modification);

Back to the top