()V"
- });
- assertFalse("Y#foo() should not be a subsignature of X#foo()", bindings[1].isSubsignature(bindings[0]));
- }
-
- /*
- * Ensures that a method in a subtype overrides the corresponding method in the super type
- * even if the two methods have different return types.
- * (regression test for bug 105808 [1.5][dom] FunctionBinding#overrides(..) should not consider return types)
- */
- public void test032() throws CoreException {
- try {
- IJavaScriptProject project = createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, "", "1.4");
- IFunctionBinding[] bindings = createMethodBindings(
- new String[] {
- "/P/p1/X.js",
- "package p1;\n" +
- "public class X {\n" +
- " Object foo() {\n" +
- " }\n" +
- "}",
- "/P/p1/Y.js",
- "package p1;\n" +
- "public class Y extends X {\n" +
- " String foo() {\n" +
- " }\n" +
- "}",
- },
- new String[] {
- "Lp1/Y;.foo()Ljava/lang/String;",
- "Lp1/X;.foo()Ljava/lang/Object;"
- },
- project);
- assertTrue("Y#foo() should override X#foo()", bindings[0].overrides(bindings[1]));
- } finally {
- deleteProject("P2");
- }
- }
-
- /*
- * Ensures that a method in a subtype doesn't override the corresponding private method in the super type.
- * (regression test for bug 132191 IFunctionBinding.overrides(IFunctionBinding) returns true even if the given argument is private.)
- */
- public void test033() throws JavaScriptModelException {
- IFunctionBinding[] bindings = createMethodBindings(
- new String[] {
- "/P/p1/X.js",
- "package p1;\n" +
- "public class X {\n" +
- " private void foo() {\n" +
- " }\n" +
- "}",
- "/P/p1/Y.js",
- "package p1;\n" +
- "public class Y extends X {\n" +
- " void foo() {\n" +
- " }\n" +
- "}",
- },
- new String[] {
- "Lp1/Y;.foo()V",
- "Lp1/X;.foo()V"
- });
- assertTrue("Y#foo() should not override X#foo()", !bindings[0].overrides(bindings[1]));
- }
-
- /*
- * Ensures that a method in a subtype doesn't override the corresponding default method in the super type in a different package.
- * (regression test for bug 132191 IFunctionBinding.overrides(IFunctionBinding) returns true even if the given argument is private.)
- */
- public void test034() throws JavaScriptModelException {
- IFunctionBinding[] bindings = createMethodBindings(
- new String[] {
- "/P/p1/X.js",
- "package p1;\n" +
- "public class X {\n" +
- " void foo() {\n" +
- " }\n" +
- "}",
- "/P/p2/Y.js",
- "package p2;\n" +
- "public class Y extends p1.X {\n" +
- " void foo() {\n" +
- " }\n" +
- "}",
- },
- new String[] {
- "Lp2/Y;.foo()V",
- "Lp1/X;.foo()V"
- });
- assertTrue("Y#foo() should not override X#foo()", !bindings[0].overrides(bindings[1]));
- }
-
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ConverterTestSetup.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ConverterTestSetup.java
deleted file mode 100644
index 34650fd..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ConverterTestSetup.java
+++ /dev/null
@@ -1,564 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.jsdt.core.IClassFile;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.compiler.IProblem;
-import org.eclipse.wst.jsdt.core.compiler.libraries.SystemLibraryLocation;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTParser;
-import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
-import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ArrayAccess;
-import org.eclipse.wst.jsdt.core.dom.ArrayCreation;
-import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.Assignment;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.BodyDeclaration;
-import org.eclipse.wst.jsdt.core.dom.BooleanLiteral;
-import org.eclipse.wst.jsdt.core.dom.CharacterLiteral;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.ConditionalExpression;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.FunctionRef;
-import org.eclipse.wst.jsdt.core.dom.ImportDeclaration;
-import org.eclipse.wst.jsdt.core.dom.InfixExpression;
-import org.eclipse.wst.jsdt.core.dom.Initializer;
-import org.eclipse.wst.jsdt.core.dom.InstanceofExpression;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.MemberRef;
-import org.eclipse.wst.jsdt.core.dom.NullLiteral;
-import org.eclipse.wst.jsdt.core.dom.NumberLiteral;
-import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression;
-import org.eclipse.wst.jsdt.core.dom.PostfixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrefixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrimitiveType;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.QualifiedType;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.StringLiteral;
-import org.eclipse.wst.jsdt.core.dom.SuperFieldAccess;
-import org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation;
-import org.eclipse.wst.jsdt.core.dom.ThisExpression;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.TypeLiteral;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.tests.util.Util;
-
-public abstract class ConverterTestSetup extends AbstractASTTests {
-
- /** @deprecated Using deprecated code */
- public static final int AST_INTERNAL_JLS2 = AST.JLS2;
-
- protected AST ast;
- static List TEST_SUITES = null;
- static boolean PROJECT_SETUP = false;
-
- protected ConverterTestSetup(String name) {
- super(name);
- }
-
- protected IPath getConverterJCLPath() {
- return getConverterJCLPath(""); //$NON-NLS-1$
- }
-
- protected IPath getConverterJCLPath(String compliance) {
- return new Path(new SystemLibraryLocation().getLibraryPath("system.js"));
- }
-
- protected IPath getConverterJCLRootSourcePath() {
- return new Path(""); //$NON-NLS-1$
- }
-
- /**
- * Reset the jar placeholder and delete project.
- */
- public void tearDownSuite() throws Exception {
- ast = null;
- if (TEST_SUITES == null) {
- this.deleteProject("Converter"); //$NON-NLS-1$
- } else {
- TEST_SUITES.remove(getClass());
- if (TEST_SUITES.size() == 0) {
- this.deleteProject("Converter"); //$NON-NLS-1$
- }
- }
- super.tearDown();
- }
-
- public void setUpJCLClasspathVariables() throws JavaScriptModelException, IOException {
- if (JavaScriptCore.getIncludepathVariable("CONVERTER_JCL_LIB") == null) {
- JavaScriptCore.setIncludepathVariables(
- new String[] {"CONVERTER_JCL_LIB", "CONVERTER_JCL_SRCROOT"},
- new IPath[] {getConverterJCLPath(), getConverterJCLRootSourcePath()},
- null);
- }
- }
-
- /**
- * Create project and set the jar placeholder.
- */
- public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- if (!PROJECT_SETUP) {
- setUpJavaProject("Converter"); //$NON-NLS-1$
- waitUntilIndexesReady(); // needed to find secondary types
- PROJECT_SETUP = true;
- }
- }
-
- public ASTNode runConversion(IJavaScriptUnit unit, boolean resolveBindings) {
- return runConversion(AST_INTERNAL_JLS2, unit, resolveBindings);
- }
-
- public ASTNode runConversion(IJavaScriptUnit unit, int position, boolean resolveBindings) {
- return runConversion(AST_INTERNAL_JLS2, unit, position, resolveBindings);
- }
-
- public ASTNode runConversion(IClassFile classFile, int position, boolean resolveBindings) {
- return runConversion(AST_INTERNAL_JLS2, classFile, position, resolveBindings);
- }
-
- public ASTNode runConversion(char[] source, String unitName, IJavaScriptProject project) {
- return runConversion(AST_INTERNAL_JLS2, source, unitName, project);
- }
-
- public ASTNode runConversion(char[] source, String unitName, IJavaScriptProject project, boolean resolveBindings) {
- return runConversion(AST_INTERNAL_JLS2, source, unitName, project, resolveBindings);
- }
-
- public ASTNode runConversion(int astLevel, IJavaScriptUnit unit, boolean resolveBindings) {
- return runConversion(astLevel, unit, resolveBindings, false);
- }
-
- public ASTNode runConversion(int astLevel, IJavaScriptUnit unit, boolean resolveBindings, boolean statementsRecovery) {
- ASTParser parser = ASTParser.newParser(astLevel);
- parser.setSource(unit);
- parser.setResolveBindings(resolveBindings);
- parser.setStatementsRecovery(statementsRecovery);
- return parser.createAST(null);
- }
-
- class NullBindingVerifier extends ASTVisitor {
-
- public void endVisit(ArrayAccess node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(ArrayCreation node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(ArrayInitializer node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(Assignment node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(BooleanLiteral node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(CharacterLiteral node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(ClassInstanceCreation node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(ConditionalExpression node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(FieldAccess node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(InfixExpression node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(InstanceofExpression node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(FunctionInvocation node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(NullLiteral node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(NumberLiteral node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(ParenthesizedExpression node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(PostfixExpression node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(PrefixExpression node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(StringLiteral node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(SuperFieldAccess node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(SuperMethodInvocation node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(ThisExpression node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(TypeLiteral node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(VariableDeclarationExpression node) {
- assertNotNull(node+" should have a binding", node.resolveTypeBinding());
- super.endVisit(node);
- }
-
- public void endVisit(AnonymousClassDeclaration node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(ArrayType node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(ImportDeclaration node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(MemberRef node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(FunctionDeclaration node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(FunctionRef node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(PackageDeclaration node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(PrimitiveType node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(QualifiedName node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(QualifiedType node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(SimpleName node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(SimpleType node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(SingleVariableDeclaration node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(TypeDeclaration node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(TypeDeclarationStatement node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- public void endVisit(VariableDeclarationFragment node) {
- assertNotNull(node+" should have a binding", node.resolveBinding());
- super.endVisit(node);
- }
-
- }
- public ASTNode runJLS3Conversion(IJavaScriptUnit unit, boolean resolveBindings, boolean checkJLS2) {
-
- // Create parser
- ASTParser parser;
- if (checkJLS2) {
- parser = ASTParser.newParser(AST_INTERNAL_JLS2);
- parser.setSource(unit);
- parser.setResolveBindings(resolveBindings);
- parser.createAST(null);
- }
-
- parser = ASTParser.newParser(AST.JLS3);
- parser.setSource(unit);
- parser.setResolveBindings(resolveBindings);
-
- // Parse compilation unit
- ASTNode result = parser.createAST(null);
-
- // Verify we get a compilation unit node and that binding are correct
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- if (resolveBindings && compilationUnit.getProblems().length == 0) {
- compilationUnit.accept(new NullBindingVerifier());
- }
- return result;
- }
-
- public ASTNode runConversion(int astLevel, IJavaScriptUnit unit, int position, boolean resolveBindings) {
-
- // Create parser
- ASTParser parser = ASTParser.newParser(astLevel);
- parser.setSource(unit);
- parser.setFocalPosition(position);
- parser.setResolveBindings(resolveBindings);
-
- // Parse compilation unit
- ASTNode result = parser.createAST(null);
-
- // Verify we get a compilation unit node and that binding are correct
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- if (resolveBindings && compilationUnit.getProblems().length == 0) {
- compilationUnit.accept(new NullBindingVerifier());
- }
- return result;
- }
-
- public ASTNode runConversion(int astLevel, IClassFile classFile, int position, boolean resolveBindings) {
-
- // Create parser
- ASTParser parser = ASTParser.newParser(astLevel);
- parser.setSource(classFile);
- parser.setFocalPosition(position);
- parser.setResolveBindings(resolveBindings);
-
- // Parse compilation unit
- ASTNode result = parser.createAST(null);
-
- // Verify we get a compilation unit node and that binding are correct
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- if (resolveBindings && compilationUnit.getProblems().length == 0) {
- compilationUnit.accept(new NullBindingVerifier());
- }
- return result;
- }
-
- public ASTNode runConversion(int astLevel, char[] source, String unitName, IJavaScriptProject project) {
- return runConversion(astLevel, source, unitName, project, false);
- }
-
- public ASTNode runConversion(int astLevel, char[] source, String unitName, IJavaScriptProject project, boolean resolveBindings) {
- return runConversion(astLevel, source, unitName, project, null, resolveBindings);
- }
-
- public ASTNode runConversion(int astLevel, char[] source, String unitName, IJavaScriptProject project, Map options, boolean resolveBindings) {
- ASTParser parser = ASTParser.newParser(astLevel);
- parser.setSource(source);
- parser.setUnitName(unitName);
- parser.setProject(project);
- if (options != null) {
- parser.setCompilerOptions(options);
- }
- parser.setResolveBindings(resolveBindings);
- return parser.createAST(null);
- }
-
- public ASTNode runConversion(int astLevel, char[] source, String unitName, IJavaScriptProject project, Map options) {
- return runConversion(astLevel, source, unitName, project, options, false);
- }
-
- public ASTNode runConversion(char[] source, String unitName, IJavaScriptProject project, Map options, boolean resolveBindings) {
- return runConversion(AST_INTERNAL_JLS2, source, unitName, project, options, resolveBindings);
- }
- public ASTNode runConversion(char[] source, String unitName, IJavaScriptProject project, Map options) {
- return runConversion(AST_INTERNAL_JLS2, source, unitName, project, options);
- }
-
- protected ASTNode getASTNodeToCompare(org.eclipse.wst.jsdt.core.dom.JavaScriptUnit unit) {
- ExpressionStatement statement = (ExpressionStatement) getASTNode(unit, 0, 0, 0);
- return (ASTNode) ((FunctionInvocation) statement.getExpression()).arguments().get(0);
- }
-
- protected ASTNode getASTNode(org.eclipse.wst.jsdt.core.dom.JavaScriptUnit unit, int typeIndex, int bodyIndex, int statementIndex) {
- BodyDeclaration bodyDeclaration = (BodyDeclaration) getASTNode(unit, typeIndex, bodyIndex);
- if (bodyDeclaration instanceof FunctionDeclaration) {
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- return (ASTNode) block.statements().get(statementIndex);
- } else if (bodyDeclaration instanceof TypeDeclaration) {
- TypeDeclaration typeDeclaration = (TypeDeclaration) bodyDeclaration;
- return (ASTNode) typeDeclaration.bodyDeclarations().get(statementIndex);
- } else if (bodyDeclaration instanceof Initializer) {
- Initializer initializer = (Initializer) bodyDeclaration;
- Block block = initializer.getBody();
- return (ASTNode) block.statements().get(statementIndex);
- }
- return null;
- }
-
- protected ASTNode getASTNode(org.eclipse.wst.jsdt.core.dom.JavaScriptUnit unit, int typeIndex, int bodyIndex) {
- return (ASTNode) unit.statements().get(bodyIndex);
- }
-
- protected ASTNode getASTNode(org.eclipse.wst.jsdt.core.dom.JavaScriptUnit unit, int typeIndex) {
- return (ASTNode) unit.types().get(typeIndex);
- }
-
- protected void checkSourceRange(ASTNode node, String expectedContents, String source) {
- assertNotNull("The node is null", node); //$NON-NLS-1$
- assertTrue("The node(" + node.getClass() + ").getLength() == 0", node.getLength() != 0); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("The node.getStartPosition() == -1", node.getStartPosition() != -1); //$NON-NLS-1$
- int length = node.getLength();
- int start = node.getStartPosition();
- String actualContentsString = source.substring(start, start + length);
- assertSourceEquals("Unexpected source", Util.convertToIndependantLineDelimiter(expectedContents), Util.convertToIndependantLineDelimiter(actualContentsString));
- }
-
- protected void checkSourceRange(ASTNode node, String expectedContents, char[] source) {
- assertNotNull("The node is null", node); //$NON-NLS-1$
- assertTrue("The node(" + node.getClass() + ").getLength() == 0", node.getLength() != 0); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("The node.getStartPosition() == -1", node.getStartPosition() != -1); //$NON-NLS-1$
- int length = node.getLength();
- int start = node.getStartPosition();
- char[] actualContents = new char[length];
- System.arraycopy(source, start, actualContents, 0, length);
- String actualContentsString = new String(actualContents);
- assertSourceEquals("Unexpected source", Util.convertToIndependantLineDelimiter(expectedContents), Util.convertToIndependantLineDelimiter(actualContentsString));
- }
-
- protected boolean isMalformed(ASTNode node) {
- return (node.getFlags() & ASTNode.MALFORMED) != 0;
- }
-
- protected boolean isRecovered(ASTNode node) {
- return (node.getFlags() & ASTNode.RECOVERED) != 0;
- }
-
- protected boolean isOriginal(ASTNode node) {
- return (node.getFlags() & ASTNode.ORIGINAL) != 0;
- }
-
- protected void assertProblemsSize(JavaScriptUnit compilationUnit, int expectedSize) {
- assertProblemsSize(compilationUnit, expectedSize, "");
- }
- protected void assertProblemsSize(JavaScriptUnit compilationUnit, int expectedSize, String expectedOutput) {
- final IProblem[] problems = compilationUnit.getProblems();
- final int length = problems.length;
- if (length != expectedSize) {
- checkProblemMessages(expectedOutput, problems, length);
- assertEquals("Wrong size", expectedSize, length);
- }
- checkProblemMessages(expectedOutput, problems, length);
- }
-
- private void checkProblemMessages(String expectedOutput, final IProblem[] problems, final int length) {
- if (length != 0) {
- if (expectedOutput != null) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < length; i++) {
- buffer.append(problems[i].getMessage());
- if (i < length - 1) {
- buffer.append('\n');
- }
- }
- String actualOutput = String.valueOf(buffer);
- expectedOutput = Util.convertToIndependantLineDelimiter(expectedOutput);
- actualOutput = Util.convertToIndependantLineDelimiter(actualOutput);
- if (!expectedOutput.equals(actualOutput)) {
- System.out.println(Util.displayString(actualOutput));
- assertEquals("different output", expectedOutput, actualOutput);
- }
- }
- }
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/GetKeyVisitor.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/GetKeyVisitor.java
deleted file mode 100644
index 650a0d7..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/GetKeyVisitor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import junit.framework.Assert;
-import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.IFunctionBinding;
-
-class GetKeyVisitor extends ASTVisitor {
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.SimpleName)
- */
- public boolean visit(ClassInstanceCreation node) {
- IFunctionBinding constructorBinding = node.resolveConstructorBinding();
- Assert.assertNotNull(constructorBinding);
- Assert.assertNotNull(constructorBinding.getKey());
- return super.visit(node);
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ProfilingASTConvertionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ProfilingASTConvertionTest.java
deleted file mode 100644
index 00ecd2b..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ProfilingASTConvertionTest.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.io.File;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IPackageFragment;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTParser;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.tests.model.AbstractJavaModelTests;
-
-public class ProfilingASTConvertionTest extends AbstractJavaModelTests {
-
- static class Result implements Comparable {
- long length;
- long time;
- String unitName;
- Result(String unitName, long time, long length) {
- this.time = time;
- this.unitName = unitName;
- this.length = length / 1024;
- }
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object o) {
- Result result = (Result) o;
- if (this.time < result.time) {
- return -1;
- } else if (this.time == result.time) {
- return 0;
- }
- return 1;
- }
- }
- private static final int INCREMENTS = 100;
-
- private static boolean RESOLVE_BINDINGS = false;
-
- public static Test suite() {
- return buildModelTestSuite(ProfilingASTConvertionTest.class);
- }
-
- IJavaScriptUnit[] compilationUnits;
-
- public ProfilingASTConvertionTest(String name) {
- super(name);
- }
-
- public String display(int value, int numberOfFiguresForRange) {
- int numberOfFigures = value == 0 ? 1 : (int) (Math.log(value)/ Math.log(10));
- if ((value % 10) == 0) {
- numberOfFigures = (int) (Math.log(value + 1)/ Math.log(10));
- }
- StringBuffer buffer = new StringBuffer();
- while(numberOfFigures < numberOfFiguresForRange) {
- buffer.append(" ");
- numberOfFigures++;
- }
- buffer.append(value);
- return String.valueOf(buffer);
- }
-
- /**
- * @param array
- * @param increment
- */
- private void printDistribution(long[] array, int increment) {
- int bound = increment;
- int counter = 0;
- int totalCounter = 0;
- int length = array.length;
- long max = array[length - 1];
- int numberOfFiguresForRange = (int) (Math.log(max)/ Math.log(10));
- if ((max % increment) == 0) {
- numberOfFiguresForRange = (int) (Math.log(max + 1)/ Math.log(10));
- }
- int numberOfFiguresForCounter = (int) (Math.log(length)/ Math.log(10));
- if ((length % increment) == 0) {
- numberOfFiguresForCounter = (int) (Math.log(length + 1)/ Math.log(10));
- }
- for (int i = 0; i < length; i++) {
- if (array[i] < bound) {
- counter++;
- } else {
- i--;
- totalCounter += counter;
- printRange(counter, bound, increment, totalCounter, length, numberOfFiguresForRange, numberOfFiguresForCounter);
- counter = 0;
- bound += increment;
- }
- }
- totalCounter += counter;
- printRange(counter, bound, increment, totalCounter, length, numberOfFiguresForRange, numberOfFiguresForCounter);
- }
-
- /**
- * @param counter
- * @param bound
- */
- private void printRange(int counter, int bound, int increment, int totalCounter, int length, int numberOfFiguresForRange, int numberOfFiguresForCounters) {
- if (counter != 0) {
- StringBuffer buffer = new StringBuffer();
- int low = bound - increment;
- if (low != 0) {
- low++;
- }
- DecimalFormat format = new DecimalFormat("###.##");
- buffer
- .append(display(low, numberOfFiguresForRange))
- .append(" - ")
- .append(display(bound, numberOfFiguresForRange))
- .append(" : ")
- .append(display(counter, numberOfFiguresForCounters))
- .append("\t\t")
- .append(format.format(100.0 * ((double) totalCounter / length)));
- System.out.println(String.valueOf(buffer));
- }
- }
-
- /**
- * @param totalTime
- * @param length
- * @param times
- * @param arrayList
- * @deprecated using deprecated code
- */
- private void reportResults(int apiLevel, long totalTime, int length, long[] times, ArrayList arrayList) {
- System.out.println("===============================================================================");
- System.out.print("================================ ");
- switch(apiLevel) {
- case AST.JLS2 :
- System.out.print("JLS2");
- break;
- case AST.JLS3 :
- System.out.print("JLS3");
- break;
- }
- System.out.print(" BINDING IS ");
- System.out.print(RESOLVE_BINDINGS ? "ON " : "OFF ");
- System.out.println("==========================");
- System.out.println("===============================================================================");
- Arrays.sort(times);
- System.out.println("===================================== TIMES ===================================");
- System.out.println("Fastest = " + times[0] + "ms");
- long maxTime = times[length - 1];
- System.out.println("Slowest = " + maxTime + "ms");
- System.out.println("Total = " + totalTime + "ms");
- System.out.println("================================== DISTRIBUTION ===============================");
- printDistribution(times, INCREMENTS);
- System.out.println("================================= SORTED BY TIME ==============================");
- Collections.sort(arrayList);
- for (Iterator iterator = arrayList.iterator(); iterator.hasNext(); ) {
- final Result next = (Result) iterator.next();
- System.out.println(next.unitName + "(" + next.length + "KB) - " + next.time + "ms");
- }
- System.out.println("================================ SORTED BY LENGTH =============================");
- Collections.sort(arrayList, new Comparator() {
- /* (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- Result r1 = (Result) o1;
- Result r2 = (Result) o2;
- if (r1.length < r2.length) {
- return -1;
- } else if (r1.length == r2.length) {
- return 0;
- }
- return 1;
- }
- });
- for (Iterator iterator = arrayList.iterator(); iterator.hasNext(); ) {
- final Result next = (Result) iterator.next();
- System.out.println(next.unitName + "(" + next.length + "KB) - " + next.time + "ms");
- }
- }
-
- public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- // ensure variables are set
- if (JavaScriptCore.getIncludepathVariable("CONVERTER_JCL_LIB") == null) { //$NON-NLS-1$
- setupExternalJCL("converterJclMin");
- JavaScriptCore.setIncludepathVariables(
- new String[] {"CONVERTER_JCL_LIB", "CONVERTER_JCL_SRC", "CONVERTER_JCL_SRCROOT"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new Path[] {new Path(getExternalPath() + "converterJclMin.jar"), new Path(getExternalPath() + "converterJclMinsrc.zip"), new Path("")},
- null);
- }
-
- IJavaScriptProject javaProject = setUpJavaProject("Compiler", "1.4"); //$NON-NLS-1$ //$NON-NLS-2$
- assertNotNull("No java project", javaProject);
- IPackageFragment[] packageFragments = javaProject.getPackageFragments();
- assertNotNull("No package fragments", packageFragments);
- ArrayList collector = new ArrayList();
- for (int i = 0, max = packageFragments.length; i < max; i++) {
- IJavaScriptUnit[] units = packageFragments[i].getJavaScriptUnits();
- if (units != null) {
- for (int j = 0, max2 = units.length; j < max2; j++) {
- collector.add(units[j]);
- }
- }
- }
- this.compilationUnits = new IJavaScriptUnit[collector.size()];
- collector.toArray(this.compilationUnits);
- }
-
- public void test0000() throws JavaScriptModelException {
- try {
- RESOLVE_BINDINGS = true;
- final int apiLevel = AST.JLS3;
- ASTParser parser = ASTParser.newParser(apiLevel);
- parser.setResolveBindings(RESOLVE_BINDINGS);
- long totalTime = 0;
- int length = this.compilationUnits.length;
- long[] times = new long[length];
- ArrayList arrayList = new ArrayList(length);
- for (int i = 0; i < length; i++) {
- parser.setSource(this.compilationUnits[i]);
- parser.setResolveBindings(RESOLVE_BINDINGS);
- long time = System.currentTimeMillis();
- ASTNode node = parser.createAST(null);
- times[i] = System.currentTimeMillis() - time;
- totalTime += times[i];
- assertNotNull("No node", node);
- assertEquals("Wrong type", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertEquals("Has problem", 0, unit.getProblems().length);
- TypeDeclaration typeDeclaration = (TypeDeclaration) unit.types().get(0);
- StringBuffer buffer = new StringBuffer();
- buffer.append(unit.getPackage().getName()).append(".").append(typeDeclaration.getName());
- IResource resource = this.compilationUnits[i].getResource();
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- File f = new File(file.getLocation().toOSString());
- if (f.exists()) {
- arrayList.add(new Result(String.valueOf(buffer), times[i], f.length()));
- }
- }
- }
- } finally {
- RESOLVE_BINDINGS = false;
- }
- }
-
- public void test0001() throws JavaScriptModelException {
- try {
- RESOLVE_BINDINGS = true;
- final int apiLevel = AST.JLS3;
- ASTParser parser = ASTParser.newParser(apiLevel);
- parser.setResolveBindings(RESOLVE_BINDINGS);
- long totalTime = 0;
- int length = this.compilationUnits.length;
- long[] times = new long[length];
- ArrayList arrayList = new ArrayList(length);
- for (int i = 0; i < length; i++) {
- parser.setSource(this.compilationUnits[i]);
- parser.setResolveBindings(RESOLVE_BINDINGS);
- long time = System.currentTimeMillis();
- ASTNode node = parser.createAST(null);
- times[i] = System.currentTimeMillis() - time;
- totalTime += times[i];
- assertNotNull("No node", node);
- assertEquals("Wrong type", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertEquals("Has problem", 0, unit.getProblems().length);
- TypeDeclaration typeDeclaration = (TypeDeclaration) unit.types().get(0);
- StringBuffer buffer = new StringBuffer();
- buffer.append(unit.getPackage().getName()).append(".").append(typeDeclaration.getName());
- IResource resource = this.compilationUnits[i].getResource();
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- File f = new File(file.getLocation().toOSString());
- if (f.exists()) {
- arrayList.add(new Result(String.valueOf(buffer), times[i], f.length()));
- }
- }
- }
- reportResults(apiLevel, totalTime, length, times, arrayList);
- } finally {
- RESOLVE_BINDINGS = false;
- }
- }
-
- public void test0002() throws JavaScriptModelException {
- try {
- RESOLVE_BINDINGS = false;
- final int apiLevel = AST.JLS3;
- ASTParser parser = ASTParser.newParser(apiLevel);
- parser.setResolveBindings(RESOLVE_BINDINGS);
- long totalTime = 0;
- int length = this.compilationUnits.length;
- long[] times = new long[length];
- ArrayList arrayList = new ArrayList(length);
- for (int i = 0; i < length; i++) {
- parser.setSource(this.compilationUnits[i]);
- parser.setResolveBindings(RESOLVE_BINDINGS);
- long time = System.currentTimeMillis();
- ASTNode node = parser.createAST(null);
- times[i] = System.currentTimeMillis() - time;
- totalTime += times[i];
- assertNotNull("No node", node);
- assertEquals("Wrong type", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertEquals("Has problem", 0, unit.getProblems().length);
- TypeDeclaration typeDeclaration = (TypeDeclaration) unit.types().get(0);
- StringBuffer buffer = new StringBuffer();
- buffer.append(unit.getPackage().getName()).append(".").append(typeDeclaration.getName());
- IResource resource = this.compilationUnits[i].getResource();
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- File f = new File(file.getLocation().toOSString());
- if (f.exists()) {
- arrayList.add(new Result(String.valueOf(buffer), times[i], f.length()));
- }
- }
- }
- reportResults(apiLevel, totalTime, length, times, arrayList);
- } finally {
- RESOLVE_BINDINGS = false;
- }
- }
-}
-
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunAllTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunAllTests.java
deleted file mode 100644
index 2d7e91f..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunAllTests.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.lang.reflect.*;
-
-import org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class RunAllTests extends junit.framework.TestCase {
-public RunAllTests(String name) {
- super(name);
-}
-public static Class[] getAllTestClasses() {
- return new Class[] {
- //org.eclipse.wst.jsdt.core.tests.dom.RunConverterTests.class,
- org.eclipse.wst.jsdt.core.tests.dom.ASTTest.class,
- org.eclipse.wst.jsdt.core.tests.dom.ASTVisitorTest.class,
- //org.eclipse.wst.jsdt.core.tests.dom.ASTMatcherTest.class,
- //org.eclipse.wst.jsdt.core.tests.dom.ASTStructuralPropertyTest.class,
- org.eclipse.wst.jsdt.core.tests.dom.ASTParserTest.class,
- //org.eclipse.wst.jsdt.core.tests.dom.ASTModelBridgeTests.class,
- // org.eclipse.wst.jsdt.core.tests.dom.BatchASTCreationTests.class,
- //org.eclipse.wst.jsdt.core.tests.dom.CompatibilityRulesTests.class,
- org.eclipse.wst.jsdt.core.tests.rewrite.describing.ASTRewritingTest.class,
- org.eclipse.wst.jsdt.core.tests.rewrite.modifying.ASTRewritingModifyingTest.class,
- org.eclipse.wst.jsdt.core.tests.dom.ASTPositionsTest.class,
- };
-}
-public static Test suite() {
- TestSuite ts = new TestSuite(RunAllTests.class.getName());
-
- Class[] testClasses = getAllTestClasses();
- // Reset forgotten subsets of tests
- TestCase.TESTS_PREFIX = null;
- TestCase.TESTS_NAMES = null;
- TestCase.TESTS_NUMBERS = null;
- TestCase.TESTS_RANGE = null;
- TestCase.RUN_ONLY_ID = null;
-
- for (int i = 0; i < testClasses.length; i++) {
- Class testClass = testClasses[i];
-
- // call the suite() method and add the resulting suite to the suite
- try {
- Method suiteMethod = testClass.getDeclaredMethod("suite", new Class[0]); //$NON-NLS-1$
- Test suite = (Test)suiteMethod.invoke(null, new Object[0]);
- ts.addTest(suite);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.getTargetException().printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- }
- return ts;
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunConverterTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunConverterTests.java
deleted file mode 100644
index af8f0ec..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunConverterTests.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.lang.reflect.*;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class RunConverterTests extends junit.framework.TestCase {
-public RunConverterTests(String name) {
- super(name);
-}
-public static Class[] getAllTestClasses() {
- return new Class[] {
- ASTConverterTest.class,
- ASTConverterTest2.class,
- ASTConverterJavadocTest.class,
- ASTConverterAST3Test.class,
- ASTConverterTestAST3_2.class,
- ASTConverterBindingsTest.class,
- ASTConverterRecoveryTest.class
- };
-}
-public static Test suite() {
- TestSuite ts = new TestSuite(RunConverterTests.class.getName());
-
- ConverterTestSetup.TEST_SUITES = new ArrayList(Arrays.asList(getAllTestClasses()));
- // Reset forgotten subsets of tests
- TestCase.TESTS_PREFIX = null;
- TestCase.TESTS_NAMES = null;
- TestCase.TESTS_NUMBERS = null;
- TestCase.TESTS_RANGE = null;
- TestCase.RUN_ONLY_ID = null;
-
- for (int i = 0, l=ConverterTestSetup.TEST_SUITES.size(); i < l; i++) {
- Class testClass = (Class) ConverterTestSetup.TEST_SUITES.get(i);
-
- // call the suite() method and add the resulting suite to the suite
- try {
- Method suiteMethod = testClass.getDeclaredMethod("suite", new Class[0]); //$NON-NLS-1$
- Test suite = (Test)suiteMethod.invoke(null, new Object[0]);
- ts.addTest(suite);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.getTargetException().printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- }
- return ts;
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/SampleASTs.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/SampleASTs.java
deleted file mode 100644
index 63e7bea..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/SampleASTs.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ArrayAccess;
-import org.eclipse.wst.jsdt.core.dom.ArrayCreation;
-import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.Assignment;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.BooleanLiteral;
-import org.eclipse.wst.jsdt.core.dom.BreakStatement;
-import org.eclipse.wst.jsdt.core.dom.CatchClause;
-import org.eclipse.wst.jsdt.core.dom.CharacterLiteral;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.ConditionalExpression;
-import org.eclipse.wst.jsdt.core.dom.ConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.ContinueStatement;
-import org.eclipse.wst.jsdt.core.dom.DoStatement;
-import org.eclipse.wst.jsdt.core.dom.EmptyStatement;
-import org.eclipse.wst.jsdt.core.dom.EnhancedForStatement;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.FieldDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ForStatement;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.FunctionRef;
-import org.eclipse.wst.jsdt.core.dom.IfStatement;
-import org.eclipse.wst.jsdt.core.dom.ImportDeclaration;
-import org.eclipse.wst.jsdt.core.dom.InfixExpression;
-import org.eclipse.wst.jsdt.core.dom.Initializer;
-import org.eclipse.wst.jsdt.core.dom.InstanceofExpression;
-import org.eclipse.wst.jsdt.core.dom.JSdoc;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.LabeledStatement;
-import org.eclipse.wst.jsdt.core.dom.Name;
-import org.eclipse.wst.jsdt.core.dom.NullLiteral;
-import org.eclipse.wst.jsdt.core.dom.NumberLiteral;
-import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression;
-import org.eclipse.wst.jsdt.core.dom.PostfixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrefixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrimitiveType;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.QualifiedType;
-import org.eclipse.wst.jsdt.core.dom.ReturnStatement;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.StringLiteral;
-import org.eclipse.wst.jsdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.SuperFieldAccess;
-import org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation;
-import org.eclipse.wst.jsdt.core.dom.SwitchCase;
-import org.eclipse.wst.jsdt.core.dom.SwitchStatement;
-import org.eclipse.wst.jsdt.core.dom.TagElement;
-import org.eclipse.wst.jsdt.core.dom.ThisExpression;
-import org.eclipse.wst.jsdt.core.dom.ThrowStatement;
-import org.eclipse.wst.jsdt.core.dom.TryStatement;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.TypeLiteral;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.WhileStatement;
-
-public class SampleASTs {
- /**
- * Returns a subtree of sample of AST nodes. The sample includes
- * one of each kind (except for BlockComment and LineComment,
- * which cannot be connected directly to a JavaScriptUnit),
- * but otherwise does not make sense.
- */
- public static ASTNode oneOfEach(AST target) {
- JavaScriptUnit cu = target.newJavaScriptUnit();
- PackageDeclaration pd = target.newPackageDeclaration();
- cu.setPackage(pd);
-
- ImportDeclaration im = target.newImportDeclaration();
- cu.imports().add(im);
-
- TypeDeclaration td = target.newTypeDeclaration();
- cu.types().add(td);
- JSdoc javadoc = target.newJSdoc();
- td.setJavadoc(javadoc);
- TagElement tg = target.newTagElement();
- javadoc.tags().add(tg);
- tg.fragments().add(target.newTextElement());
- tg.fragments().add(target.newMemberRef());
- FunctionRef mr = target.newFunctionRef();
- tg.fragments().add(mr);
- mr.parameters().add(target.newFunctionRefParameter());
-
- VariableDeclarationFragment variableDeclarationFragment = target.newVariableDeclarationFragment();
- FieldDeclaration fd =
- target.newFieldDeclaration(variableDeclarationFragment);
- td.bodyDeclarations().add(fd);
-
- Initializer in = target.newInitializer();
- td.bodyDeclarations().add(in);
-
-
- FunctionDeclaration md = target.newFunctionDeclaration();
- SingleVariableDeclaration singleVariableDeclaration = target.newSingleVariableDeclaration();
- md.parameters().add(singleVariableDeclaration);
- td.bodyDeclarations().add(md);
-
- SimpleName sn1 = target.newSimpleName("one"); //$NON-NLS-1$
- SimpleName sn2 =target.newSimpleName("two"); //$NON-NLS-1$
- QualifiedName qn = target.newQualifiedName(sn1, sn2);
-
- PrimitiveType pt = target.newPrimitiveType(PrimitiveType.INT);
- ArrayType at = target.newArrayType(pt);
- fd.setType(at);
-
- if (target.apiLevel() >= AST.JLS3) {
- SimpleType st = target.newSimpleType(qn);
- QualifiedType qt = target.newQualifiedType(st, target.newSimpleName("x")); //$NON-NLS-1$
- }
-
- Block b = target.newBlock();
- md.setBody(b);
-
- // all statements (in alphabetic order of statement type)
- Block block = target.newBlock();
- b.statements().add(block);
- BreakStatement breakStatement = target.newBreakStatement();
- b.statements().add(breakStatement);
- ContinueStatement continueStatement = target.newContinueStatement();
- b.statements().add(continueStatement);
- ConstructorInvocation constructorInvocation = target.newConstructorInvocation();
- b.statements().add(constructorInvocation);
- DoStatement doStatement = target.newDoStatement();
- b.statements().add(doStatement);
- EmptyStatement emptyStatement = target.newEmptyStatement();
- b.statements().add(emptyStatement);
- NullLiteral nullLiteral = target.newNullLiteral();
- ExpressionStatement expressionStatement = target.newExpressionStatement(nullLiteral);
- b.statements().add(expressionStatement);
- ForStatement forStatement = target.newForStatement();
- b.statements().add(forStatement);
- if (target.apiLevel() >= AST.JLS3) {
- EnhancedForStatement foreachStatement = target.newEnhancedForStatement();
- b.statements().add(foreachStatement);
- }
- IfStatement ifStatement = target.newIfStatement();
- b.statements().add(ifStatement);
- LabeledStatement labeledStatement = target.newLabeledStatement();
- b.statements().add(labeledStatement);
- ReturnStatement returnStatement = target.newReturnStatement();
- b.statements().add(returnStatement);
- SuperConstructorInvocation superConstructorInvocation = target.newSuperConstructorInvocation();
- b.statements().add(superConstructorInvocation);
- SwitchStatement ss = target.newSwitchStatement();
- SwitchCase switchCase = target.newSwitchCase();
- ss.statements().add(switchCase);
- b.statements().add(ss);
- SwitchStatement switchStatement = target.newSwitchStatement();
- b.statements().add(switchStatement);
- SwitchCase switchCase2 = target.newSwitchCase();
- b.statements().add(switchCase2);
- ThrowStatement throwStatement = target.newThrowStatement();
- b.statements().add(throwStatement);
- TryStatement tr = target.newTryStatement();
- CatchClause catchClause = target.newCatchClause();
- tr.catchClauses().add(catchClause);
- b.statements().add(tr);
-
- TypeDeclaration typeDeclaration = target.newTypeDeclaration();
- TypeDeclarationStatement typeDeclarationStatement = target.newTypeDeclarationStatement(typeDeclaration);
- b.statements().add(typeDeclarationStatement);
- VariableDeclarationFragment variableDeclarationFragment2 = target.newVariableDeclarationFragment();
- VariableDeclarationStatement variableDeclarationStatement = target.newVariableDeclarationStatement(variableDeclarationFragment2);
- b.statements().add(variableDeclarationStatement);
- WhileStatement whileStatement = target.newWhileStatement();
- b.statements().add(whileStatement);
-
- // all expressions (in alphabetic order of expressions type)
- FunctionInvocation inv = target.newFunctionInvocation();
- ExpressionStatement expressionStatement2 = target.newExpressionStatement(inv);
- b.statements().add(expressionStatement2);
- List z = inv.arguments();
- ArrayAccess arrayAccess = target.newArrayAccess();
- z.add(arrayAccess);
- ArrayCreation arrayCreation = target.newArrayCreation();
- z.add(arrayCreation);
- ArrayInitializer arrayInitializer = target.newArrayInitializer();
- z.add(arrayInitializer);
- Assignment assignment = target.newAssignment();
- z.add(assignment);
- BooleanLiteral booleanLiteral = target.newBooleanLiteral(true);
- z.add(booleanLiteral);
- CharacterLiteral characterLiteral = target.newCharacterLiteral();
- z.add(characterLiteral);
- ClassInstanceCreation cic = target.newClassInstanceCreation();
- AnonymousClassDeclaration anonymousClassDeclaration = target.newAnonymousClassDeclaration();
- cic.setAnonymousClassDeclaration(anonymousClassDeclaration);
- z.add(cic);
- ConditionalExpression conditionalExpression = target.newConditionalExpression();
- z.add(conditionalExpression);
- FieldAccess fieldAccess = target.newFieldAccess();
- z.add(fieldAccess);
- InfixExpression infixExpression = target.newInfixExpression();
- z.add(infixExpression);
- InstanceofExpression instanceofExpression = target.newInstanceofExpression();
- z.add(instanceofExpression);
- FunctionInvocation methodInvocation = target.newFunctionInvocation();
- z.add(methodInvocation);
- Name name = target.newName(new String[]{"a", "b"}); //$NON-NLS-1$ //$NON-NLS-2$
- z.add(name);
- NullLiteral nullLiteral2 = target.newNullLiteral();
- z.add(nullLiteral2);
- NumberLiteral numberLiteral = target.newNumberLiteral("1024"); //$NON-NLS-1$
- z.add(numberLiteral);
- ParenthesizedExpression parenthesizedExpression = target.newParenthesizedExpression();
- z.add(parenthesizedExpression);
- PostfixExpression postfixExpression = target.newPostfixExpression();
- z.add(postfixExpression);
- PrefixExpression prefixExpression = target.newPrefixExpression();
- z.add(prefixExpression);
- StringLiteral stringLiteral = target.newStringLiteral();
- z.add(stringLiteral);
- SuperFieldAccess superFieldAccess = target.newSuperFieldAccess();
- z.add(superFieldAccess);
- SuperMethodInvocation superMethodInvocation = target.newSuperMethodInvocation();
- z.add(superMethodInvocation);
- ThisExpression thisExpression = target.newThisExpression();
- z.add(thisExpression);
- TypeLiteral typeLiteral = target.newTypeLiteral();
- z.add(typeLiteral);
- VariableDeclarationFragment variableDeclarationFragment3 = target.newVariableDeclarationFragment();
- VariableDeclarationExpression variableDeclarationExpression = target.newVariableDeclarationExpression(variableDeclarationFragment3);
- z.add(variableDeclarationExpression);
-
-
- return cu;
- }
-
- /**
- * Returns a flat list of sample nodes of each type.
- * The sample includes one of each kind, including
- * BlockComment and LineComment.
- */
- public static List oneOfEachList(AST target) {
- List result = new ArrayList(100);
- for (int nodeType = 0; nodeType < 100; nodeType++) {
- Class nodeClass = null;
- try {
- nodeClass = ASTNode.nodeClassForType(nodeType);
- } catch (RuntimeException e) {
- // oops - guess that's not valid
- }
- if (nodeClass != null) {
- result.add(target.createInstance(nodeClass));
- }
- }
- return result;
- }
-
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/DecodeCodeFormatterPreferences.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/DecodeCodeFormatterPreferences.java
deleted file mode 100644
index a4bec45..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/DecodeCodeFormatterPreferences.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.formatter;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.LineNumberReader;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class DecodeCodeFormatterPreferences extends DefaultHandler {
-
- private boolean record;
- private Map entries;
- private String profileName;
-
- public static Map decodeCodeFormatterOptions(String fileName) {
- try {
- LineNumberReader reader = new LineNumberReader(new FileReader(fileName));
- Map options = new HashMap();
- String line;
- while ((line = reader.readLine()) != null) {
- if (line.startsWith("#")) {
- continue;
- }
- StringTokenizer stringTokenizer = new StringTokenizer(line, "=");
- options.put(stringTokenizer.nextElement(), stringTokenizer.nextElement());
- }
- reader.close();
- return options;
- } catch (IOException e) {
- // ignore
- }
- return null;
- }
-
- public static Map decodeCodeFormatterOptions(String fileName, String profileName) {
- try {
- SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
- final DecodeCodeFormatterPreferences preferences = new DecodeCodeFormatterPreferences(profileName);
- saxParser.parse(new File(fileName), preferences);
- return preferences.getEntries();
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- } catch (SAXException e) {
- e.printStackTrace();
- } catch (FactoryConfigurationError e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- public static Map decodeCodeFormatterOptions(String zipFileName, String zipEntryName, String profileName) {
- ZipFile zipFile = null;
- BufferedInputStream inputStream = null;
- try {
- zipFile = new ZipFile(zipFileName);
- ZipEntry zipEntry = zipFile.getEntry(zipEntryName);
- if (zipEntry == null) {
- return null;
- }
- inputStream = new BufferedInputStream(zipFile.getInputStream(zipEntry));
- SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
- final DecodeCodeFormatterPreferences preferences = new DecodeCodeFormatterPreferences(profileName);
- saxParser.parse(inputStream, preferences);
- return preferences.getEntries();
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- } catch (SAXException e) {
- e.printStackTrace();
- } catch (FactoryConfigurationError e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- if (inputStream != null) {
- inputStream.close();
- }
- if (zipFile != null) {
- zipFile.close();
- }
- } catch (IOException e1) {
- // Do nothing
- }
- }
- return null;
- }
-
- DecodeCodeFormatterPreferences(String profileName) {
- this.profileName = profileName;
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
-
- int attributesLength = attributes.getLength();
- if ("profile".equals(qName)) {
- for (int i = 0; i < attributesLength; i++) {
- if ("name".equals(attributes.getQName(i)) && profileName.equals(attributes.getValue(i))) {
- record = true;
- entries = new HashMap();
- break;
- }
- }
- } else if ("setting".equals(qName) && record) {
- if (attributesLength == 2) {
- entries.put(attributes.getValue(0), attributes.getValue(1));
- }
- }
- }
- /* (non-Javadoc)
- * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
- */
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
- if ("profile".equals(qName) && record) {
- record = false;
- }
- }
- /**
- * @return Returns the entries.
- */
- public Map getEntries() {
- return entries;
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/FormatterRegressionTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/FormatterRegressionTests.java
deleted file mode 100644
index 99fcf56..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/FormatterRegressionTests.java
+++ /dev/null
@@ -1,9245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.formatter;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.jsdt.core.compiler.CharOperation;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.formatter.CodeFormatter;
-import org.eclipse.wst.jsdt.core.formatter.DefaultCodeFormatterConstants;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.ToolFactory;
-import org.eclipse.wst.jsdt.core.tests.model.AbstractJavaModelTests;
-import org.eclipse.wst.jsdt.core.tests.util.Util;
-import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.wst.jsdt.internal.formatter.DefaultCodeFormatter;
-import org.eclipse.wst.jsdt.internal.formatter.DefaultCodeFormatterOptions;
-import org.eclipse.text.edits.TextEdit;
-
-public class FormatterRegressionTests extends AbstractJavaModelTests {
-
- public static final int UNKNOWN_KIND = 0;
- public static final String IN = "_in";
- public static final String OUT = "_out";
- public static final boolean DEBUG = false;
- private static final String LINE_SEPARATOR = System.getProperty("line.separator");
- private long time;
-
- static {
-// TESTS_NUMBERS = new int[] { 650 };
-// TESTS_RANGE = new int[] { 650, -1 };
- }
- public static Test suite() {
- return buildModelTestSuite(FormatterRegressionTests.class);
- }
-
- public FormatterRegressionTests(String name) {
- super(name);
- }
-
- /**
- * Returns the OS path to the directory that contains this plugin.
- */
- protected String getPluginDirectoryPath() {
- try {
- URL platformURL = Platform.getBundle("org.eclipse.wst.jsdt.core.tests.model").getEntry("/");
- return new File(FileLocator.toFileURL(platformURL).getFile()).getAbsolutePath();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private String getResource(String packageName, String resourceName) {
- IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- IResource resource = workspaceRoot.findMember(new Path("/Formatter/" + packageName + "/" + resourceName));
- assertNotNull("No resource found", resource);
- return resource.getLocation().toOSString();
- }
-
- private String getZipEntryContents(String fileName, String zipEntryName) {
- ZipFile zipFile = null;
- BufferedInputStream inputStream = null;
- try {
- zipFile = new ZipFile(fileName);
- ZipEntry zipEntry = zipFile.getEntry(zipEntryName);
- inputStream = new BufferedInputStream(zipFile.getInputStream(zipEntry));
- return new String(org.eclipse.wst.jsdt.internal.compiler.util.Util.getInputStreamAsCharArray(inputStream, -1, null));
- } catch (IOException e) {
- } finally {
- try {
- if (inputStream != null) {
- inputStream.close();
- }
- if (zipFile != null) {
- zipFile.close();
- }
- } catch (IOException e1) {
- // Do nothing
- }
- }
- return null;
- }
-
- public String getSourceWorkspacePath() {
- return getPluginDirectoryPath() + java.io.File.separator + "workspace";
- }
-
- private String runFormatter(CodeFormatter codeFormatter, String source, int kind, int indentationLevel, int offset, int length, String lineSeparator) {
-// long time = System.currentTimeMillis();
- TextEdit edit = codeFormatter.format(kind, source, offset, length, indentationLevel, lineSeparator);//$NON-NLS-1$
-// System.out.println((System.currentTimeMillis() - time) + " ms");
- if (edit == null) return null;
-// System.out.println(edit.getChildrenSize() + " edits");
- String result = org.eclipse.wst.jsdt.internal.core.util.Util.editedString(source, edit);
-
- if (length == source.length()) {
-// time = System.currentTimeMillis();
- edit = codeFormatter.format(kind, result, 0, result.length(), indentationLevel, lineSeparator);//$NON-NLS-1$
-// System.out.println((System.currentTimeMillis() - time) + " ms");
- if (edit == null) return null;
-// assertEquals("Should not have edits", 0, edit.getChildren().length);
- final String result2 = org.eclipse.wst.jsdt.internal.core.util.Util.editedString(result, edit);
- if (!result.equals(result2)) {
- assertSourceEquals("Different reformatting", Util.convertToIndependantLineDelimiter(result), Util.convertToIndependantLineDelimiter(result2));
- }
- }
- return result;
- }
-
- /**
- * Create project and set the jar placeholder.
- */
- public void setUpSuite() throws Exception {
- // ensure autobuilding is turned off
- IWorkspaceDescription description = getWorkspace().getDescription();
- if (description.isAutoBuilding()) {
- description.setAutoBuilding(false);
- getWorkspace().setDescription(description);
- }
- setUpJavaProject("Formatter"); //$NON-NLS-1$
- if (DEBUG) {
- this.time = System.currentTimeMillis();
- }
- }
-
- /**
- * Reset the jar placeholder and delete project.
- */
- public void tearDownSuite() throws Exception {
- this.deleteProject("Formatter"); //$NON-NLS-1$
- if (DEBUG) {
- System.out.println("Time spent = " + (System.currentTimeMillis() - this.time));//$NON-NLS-1$
- }
- super.tearDown();
- }
-
- private String getIn(String compilationUnitName) {
- assertNotNull(compilationUnitName);
- int dotIndex = compilationUnitName.indexOf('.');
- assertTrue(dotIndex != -1);
- return compilationUnitName.substring(0, dotIndex) + IN + compilationUnitName.substring(dotIndex);
- }
-
- private String getOut(String compilationUnitName) {
- assertNotNull(compilationUnitName);
- int dotIndex = compilationUnitName.indexOf('.');
- assertTrue(dotIndex != -1);
- return compilationUnitName.substring(0, dotIndex) + OUT + compilationUnitName.substring(dotIndex);
- }
-
- private void assertLineEquals(String actualContents, String originalSource, String expectedContents, boolean checkNull) {
- if (actualContents == null) {
- assertTrue("actualContents is null", checkNull);
- assertEquals(expectedContents, originalSource);
- return;
- }
- assertSourceEquals("Different number of length", Util.convertToIndependantLineDelimiter(expectedContents), actualContents);
- }
-
- private void runTest(String packageName, String compilationUnitName) {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, packageName, compilationUnitName, CodeFormatter.K_JAVASCRIPT_UNIT, 0);
- }
-
- private void runTest(CodeFormatter codeFormatter, String packageName, String compilationUnitName) {
- runTest(codeFormatter, packageName, compilationUnitName, CodeFormatter.K_JAVASCRIPT_UNIT, 0);
- }
-
- private void runTest(String packageName, String compilationUnitName, int kind) {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, packageName, compilationUnitName, kind, 0);
- }
-
- private void runTest(CodeFormatter codeFormatter, String packageName, String compilationUnitName, int kind) {
- runTest(codeFormatter, packageName, compilationUnitName, kind, 0, false, 0, -1);
- }
-
- private void runTest(CodeFormatter codeFormatter, String packageName, String compilationUnitName, int kind, boolean checkNull) {
- runTest(codeFormatter, packageName, compilationUnitName, kind, 0, checkNull, 0, -1);
- }
-
- private void runTest(CodeFormatter codeFormatter, String packageName, String compilationUnitName, int kind, int indentationLevel) {
- runTest(codeFormatter, packageName, compilationUnitName, kind, indentationLevel, false, 0, -1);
- }
- private void runTest(CodeFormatter codeFormatter, String packageName, String compilationUnitName, int kind, int indentationLevel, boolean checkNull, int offset, int length) {
- runTest(codeFormatter, packageName, compilationUnitName, kind, indentationLevel, checkNull, offset, length, null);
- }
-
- private void runTest(String input, String output, CodeFormatter codeFormatter, int kind, int indentationLevel, boolean checkNull, int offset, int length, String lineSeparator) {
- String result;
- if (length == -1) {
- result = runFormatter(codeFormatter, input, kind, indentationLevel, offset, input.length(), lineSeparator);
- } else {
- result = runFormatter(codeFormatter, input, kind, indentationLevel, offset, length, lineSeparator);
- }
- assertLineEquals(result, input, output, checkNull);
- }
-
- private void runTest(String source, String expectedResult, CodeFormatter codeFormatter, int kind, int indentationLevel, boolean checkNull, int offset, int length) {
- String result;
- if (length == -1) {
- result = runFormatter(codeFormatter, source, kind, indentationLevel, offset, source.length(), null);
- } else {
- result = runFormatter(codeFormatter, source, kind, indentationLevel, offset, length, null);
- }
- assertLineEquals(result, source, expectedResult, checkNull);
- }
-
- private void runTest(CodeFormatter codeFormatter, String packageName, String compilationUnitName, int kind, int indentationLevel, boolean checkNull, int offset, int length, String lineSeparator) {
- try {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Formatter" , "", packageName, getIn(compilationUnitName)); //$NON-NLS-1$ //$NON-NLS-2$
- String s = sourceUnit.getSource();
- assertNotNull(s);
- IJavaScriptUnit outputUnit = getCompilationUnit("Formatter" , "", packageName, getOut(compilationUnitName)); //$NON-NLS-1$ //$NON-NLS-2$
- assertNotNull(outputUnit);
- String result;
- if (length == -1) {
- result = runFormatter(codeFormatter, s, kind, indentationLevel, offset, s.length(), lineSeparator);
- } else {
- result = runFormatter(codeFormatter, s, kind, indentationLevel, offset, length, lineSeparator);
- }
- assertLineEquals(result, s, outputUnit.getSource(), checkNull);
- } catch (JavaScriptModelException e) {
- e.printStackTrace();
- assertTrue(false);
- }
- }
-
- String getSource(ASTNode astNode, char[] source) {
- String result = new String(CharOperation.subarray(source, astNode.getStartPosition() + 1, astNode.getStartPosition() + astNode.getLength() - 1));
- if (result.endsWith("\\n")) {
- return result.substring(0, result.length() - 2) + LINE_SEPARATOR;
- }
- return result;
- }
-
- public void _test000() {
- runTest("test002", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- public void test001() {
- runTest("test001", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- public void _test002() {
- runTest("test002", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test003() {
- runTest("test003", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test004() {
- runTest("test004", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- public void _test005() {
- runTest("test005", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test006() {
- runTest("test006", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test007() {
- runTest("test007", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test008() {
- runTest("test008", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test009() {
- runTest("test009", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test010() {
- runTest("test010", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test011() {
- runTest("test011", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test012() {
- runTest("test012", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test013() {
- runTest("test013", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test014() {
- runTest("test014", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test015() {
- runTest("test015", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test016() {
- runTest("test016", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test017() {
- runTest("test017", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test018() {
- runTest("test018", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test019() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test019", "A_1.js");//$NON-NLS-1$ //$NON-NLS-2$
-
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test019", "A_2.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test020() {
- runTest("test020", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test021() {
- runTest("test021", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test022() {
- runTest("test022", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test023() {
- runTest("test023", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test024() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test024", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test025() {
- runTest("test025", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test026() {
- runTest("test026", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test027() {
- runTest("test027", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test028() {
- runTest("test028", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test029() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.compact_else_if = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter,"test029", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test030() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test030", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test031() {
- runTest("test031", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test032() {
- runTest("test032", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test033() {
- runTest("test033", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test034() {
- runTest("test034", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test035() {
- runTest("test035", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test036() {
- runTest("test036", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test037() {
- runTest("test037", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test038() {
- runTest("test038", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test039() {
- runTest("test039", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test040() {
- runTest("test040", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test041() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_type_declaration = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test041", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test042() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_space_before_opening_brace_in_block = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test042", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test043() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_type_declaration = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test043", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test044() {
- runTest("test044", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test045() {
- runTest("test045", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test046() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_assignment_operator = false;
- preferences.insert_space_before_assignment_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test046", "A.js", CodeFormatter.K_EXPRESSION);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test047() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_assignment_operator = true;
- preferences.insert_space_before_assignment_operator = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test047", "A.js", CodeFormatter.K_STATEMENTS, 2);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test048() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_assignment_operator = true;
- preferences.insert_space_before_assignment_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test048", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test049() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_assignment_operator = true;
- preferences.insert_space_before_assignment_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test049", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test050() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_binary_operator = false;
- preferences.insert_space_before_unary_operator = false;
- preferences.insert_space_after_unary_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test050", "A.js", CodeFormatter.K_EXPRESSION);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test051() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_assignment_operator = true;
- preferences.insert_space_before_assignment_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test051", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test052() {
- runTest("test052", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test053() {
- runTest("test053", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test054() {
- runTest("test054", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test055() {
- runTest("test055", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test056() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_else_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test056", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test057() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- assertEquals(false, DefaultCodeFormatterConstants.getForceWrapping((String)options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER)));
- assertEquals(DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.getWrappingStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER)));
- assertEquals(DefaultCodeFormatterConstants.INDENT_DEFAULT, DefaultCodeFormatterConstants.getIndentStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER)));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.align_type_members_on_columns = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test057", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test058() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- assertEquals(false, DefaultCodeFormatterConstants.getForceWrapping((String)options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER)));
- assertEquals(DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.getWrappingStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER)));
- assertEquals(DefaultCodeFormatterConstants.INDENT_DEFAULT, DefaultCodeFormatterConstants.getIndentStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER)));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.align_type_members_on_columns = true;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.blank_lines_between_import_groups = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test058", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test059() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.align_type_members_on_columns = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test059", "Parser.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test060() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.align_type_members_on_columns = false;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.blank_lines_between_import_groups = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- //long time = System.currentTimeMillis();
- runTest(codeFormatter, "test060", "Parser.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test061() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.blank_lines_between_import_groups = 0;
- preferences.align_type_members_on_columns = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test061", "Parser.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test062() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_assignment_operator = true;
- preferences.insert_space_before_assignment_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test062", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test063() {
- runTest("test063", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test064() {
- runTest("test064", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // Line break inside an array initializer (line comment)
- public void _test065() {
- runTest("test065", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test066() {
- runTest("test066", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test067() {
- runTest("test067", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 3181
- public void _test068() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test068", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 3327
- public void _test069() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.blank_lines_before_method = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test069", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // 5691
- public void _test070() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test070", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test071() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.indent_body_declarations_compare_to_type_header = false;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.align_type_members_on_columns = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test071", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 7224
- public void _test072() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test072", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 7439
- public void _test073() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test073", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 12321
- public void _test074() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.insert_new_line_before_catch_in_try_statement = true;
- preferences.insert_new_line_before_else_in_if_statement = true;
- preferences.insert_new_line_before_finally_in_try_statement = true;
- preferences.insert_new_line_before_while_in_do_statement = true;
- preferences.keep_simple_if_on_one_line = false;
- preferences.keep_then_statement_on_same_line = false;
- preferences.keep_else_statement_on_same_line = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test074", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 14659
- public void _test075() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.page_width = 57;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test075", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 16231
- public void _test076() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test076", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 16233
- public void _test077() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test077", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 17349
- public void _test078() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test078", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 19811
- public void _test079() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test079", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 19811
- public void _test080() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.continuation_indentation = 2;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test080", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 19811
- public void _test081() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test081", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 19999
- public void _test082() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 2;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test082", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 20721
- public void _test083() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test083", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 21943
- public void _test084() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.insert_space_before_opening_paren_in_if = false;
- preferences.insert_space_before_opening_paren_in_for = false;
- preferences.insert_space_before_opening_paren_in_while = false;
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test084", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 21943
- public void _test085() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.insert_space_before_opening_paren_in_if = true;
- preferences.insert_space_before_opening_paren_in_for = true;
- preferences.insert_space_before_opening_paren_in_while = true;
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test085", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 22313
- public void _test086() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_before_catch_in_try_statement = true;
- preferences.insert_new_line_before_else_in_if_statement = true;
- preferences.insert_new_line_before_finally_in_try_statement = true;
- preferences.insert_new_line_before_while_in_do_statement = true;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.insert_space_before_binary_operator = false;
- preferences.insert_space_after_binary_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test086", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 23144
- public void test087() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.keep_simple_if_on_one_line = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test087", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 23144
- public void test088() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.keep_simple_if_on_one_line = false;
- preferences.keep_guardian_clause_on_one_line = false;
- preferences.keep_then_statement_on_same_line = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test088", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 24200
- public void test089() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_opening_paren_in_parenthesized_expression = true;
- preferences.insert_space_before_closing_paren_in_parenthesized_expression = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test089", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 24200
- public void test090() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_opening_bracket_in_array_reference = true;
- preferences.insert_space_before_closing_bracket_in_array_reference = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test090", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 25559
- public void _test091() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_assignment_operator = false;
- preferences.insert_space_before_assignment_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test091", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 25559
- public void test092() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_binary_operator = false;
- preferences.insert_space_before_binary_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test092", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 25559
- public void _test093() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_closing_paren_in_cast = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test093", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 25559
- public void _test094() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_assignment_operator = false;
- preferences.insert_space_before_assignment_operator = false;
- preferences.insert_space_after_comma_in_method_invocation_arguments = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test094", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 27196
- public void test095() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- preferences.indent_statements_compare_to_block = false;
- preferences.indent_statements_compare_to_body = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test095", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 28098
- public void _test096() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test096", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 34897
- public void _test097() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_opening_paren_in_method_invocation = true;
- preferences.insert_space_before_closing_paren_in_method_invocation = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test097", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 35173
- public void _test098() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.brace_position_for_anonymous_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test098", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 35433
- public void _test099() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_opening_paren_in_method_declaration = true;
- preferences.insert_space_before_opening_paren_in_for = true;
- preferences.insert_space_after_semicolon_in_for = false;
- preferences.put_empty_statement_on_new_line = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test099", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test100_B() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- //setup
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_assignment_operator = false;
- preferences.insert_space_after_assignment_operator = false;
- preferences.insert_space_after_comma_in_array_initializer = false;
- preferences.number_of_empty_lines_to_preserve = 1;
-
- //test
- preferences.insert_space_after_opening_brace_in_array_initializer = true;
-
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test100", "B.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test100_C() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- //setup
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_assignment_operator = false;
- preferences.insert_space_after_assignment_operator = false;
- preferences.insert_space_after_comma_in_array_initializer = false;
- preferences.number_of_empty_lines_to_preserve = 1;
-
- //test
- preferences.insert_space_before_closing_brace_in_array_initializer = true;
-
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test100", "C.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test100_D() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- //setup
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_assignment_operator = false;
- preferences.insert_space_after_assignment_operator = false;
- preferences.insert_space_after_comma_in_array_initializer = false;
- preferences.number_of_empty_lines_to_preserve = 1;
-
- //test
- preferences.insert_space_before_comma_in_array_initializer = true;
-
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test100", "D.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test100_E() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- //setup
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_assignment_operator = false;
- preferences.insert_space_after_assignment_operator = false;
- preferences.number_of_empty_lines_to_preserve = 1;
-
- //test
- preferences.insert_space_after_comma_in_array_initializer = true;
-
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test100", "E.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test100_F() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- //setup
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_assignment_operator = false;
- preferences.insert_space_after_assignment_operator = false;
- preferences.insert_space_after_comma_in_array_initializer = false;
- preferences.number_of_empty_lines_to_preserve = 1;
-
- //test
- preferences.insert_space_between_empty_braces_in_array_initializer = true;
-
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test100", "F.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test100_G() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- //setup
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_assignment_operator = false;
- preferences.insert_space_after_assignment_operator = false;
- preferences.number_of_empty_lines_to_preserve = 1;
-
- //test
- preferences.insert_space_after_opening_brace_in_array_initializer = true;
- preferences.insert_space_before_closing_brace_in_array_initializer = true;
- preferences.insert_space_before_comma_in_array_initializer = true;
- preferences.insert_space_after_comma_in_array_initializer = true;
- preferences.insert_space_between_empty_braces_in_array_initializer = true;
-
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test100", "G.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 36832
- public void _test101() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test101", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 37057
- public void _test102() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 1;
- preferences.line_separator = "\n";//$NON-NLS-1$
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test102", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 37106
- public void test103() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test103", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 37657
- public void test104() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_opening_paren_in_if = true;
- preferences.insert_space_before_closing_paren_in_if = true;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- preferences.insert_new_line_before_catch_in_try_statement = true;
- preferences.insert_new_line_before_else_in_if_statement = true;
- preferences.insert_new_line_before_finally_in_try_statement = true;
- preferences.insert_new_line_before_while_in_do_statement = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test104", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 38151
- public void _test105() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test105", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 39603
- public void _test106() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test106", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 39607
- public void _test107() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.keep_then_statement_on_same_line = false;
- preferences.keep_simple_if_on_one_line = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test107", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 40777
- public void _test108() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test108", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test109() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.blank_lines_before_package = 2;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test109", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test110() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.blank_lines_before_package = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test110", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test111() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.blank_lines_after_package = 1;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.blank_lines_before_new_chunk = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test111", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test112() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.blank_lines_after_package = 1;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.blank_lines_before_new_chunk = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test112", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test113() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test113", "A.js");//$NON-NLS-1$ //$NON-NLS-2
- }
-
- // bug 14659
- public void _test114() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- assertEquals(false, DefaultCodeFormatterConstants.getForceWrapping((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION)));
- assertEquals(DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.getWrappingStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION)));
- assertEquals(DefaultCodeFormatterConstants.INDENT_ON_COLUMN, DefaultCodeFormatterConstants.getIndentStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION)));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.page_width = 57;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test114", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 14659
- public void _test115() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.page_width = 57;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test115", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // bug 14659
- public void _test116() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.page_width = 57;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test116", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // JDT/UI tests
- public void _test117() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test117", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // JDT/UI tests
- public void _test118() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test118", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // JDT/UI tests
- public void _test119() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test119", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // JDT/UI tests
- public void _test120() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test120", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // JDT/UI tests
- public void test121() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test121", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // probing statements
- public void test122() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test122", "A.js", CodeFormatter.K_UNKNOWN);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // probing compilation unit
- public void _test123() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test123", "A.js", CodeFormatter.K_UNKNOWN);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // probing class body declarations
- public void _test124() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.page_width = 57;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test124", "A.js", CodeFormatter.K_UNKNOWN);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // probing expression
- public void test125() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_binary_operator = false;
- preferences.insert_space_before_unary_operator = false;
- preferences.insert_space_after_unary_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test125", "A.js", CodeFormatter.K_UNKNOWN);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // probing unrecognized source
- public void _test126() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test126", "A.js", CodeFormatter.K_UNKNOWN, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // probing unrecognized source
- public void _test127() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test127", "A.js", CodeFormatter.K_UNKNOWN);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // probing unrecognized source
- public void test128() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test128", "A.js", CodeFormatter.K_UNKNOWN, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test129() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test129", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test130() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test130", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test131() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test131", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test132() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test132", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test133() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.blank_lines_between_import_groups = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test133", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test134() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test134", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test135() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test135", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test136() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test136", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test137() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test137", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test138() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test138", "A.js", CodeFormatter.K_STATEMENTS, 2, true, 8, 37);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test139() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test139", "A.js", CodeFormatter.K_STATEMENTS, 0, true, 0, 5);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test140() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test140", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test141() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.indent_switchstatements_compare_to_cases = false;
- preferences.indent_switchstatements_compare_to_switch = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test141", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test142() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test142", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, 1);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test143() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test143", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, 1);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test144() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test144", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test145() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test145", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test146() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test146", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test147() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_assignment_operator = false;
- preferences.number_of_empty_lines_to_preserve = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test147", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test148() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test148", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test149() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test149", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test150() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test150", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test151() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test151", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test152() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test152", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test153() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.align_type_members_on_columns = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test153", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test154() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test154", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test155() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getJavaConventionsSettings());
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test155", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=44036
- public void test156() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getJavaConventionsSettings());
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test156", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test157() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test157", "A.js", CodeFormatter.K_STATEMENTS, 0, true, 11, 7);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test158() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test158", "A.js", CodeFormatter.K_STATEMENTS, 0, true, 11, 8);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test159() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test159", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44481
- */
- public void _test160() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.insert_new_line_before_catch_in_try_statement = false;
- preferences.insert_new_line_before_else_in_if_statement = false;
- preferences.insert_new_line_before_finally_in_try_statement = false;
- preferences.insert_new_line_before_while_in_do_statement = false;
- preferences.compact_else_if = true;
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test160", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44481
- */
- public void _test161() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.insert_new_line_before_catch_in_try_statement = false;
- preferences.insert_new_line_before_else_in_if_statement = false;
- preferences.insert_new_line_before_finally_in_try_statement = false;
- preferences.insert_new_line_before_while_in_do_statement = false;
- preferences.compact_else_if = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test161", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44481
- */
- public void _test162() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.insert_new_line_before_catch_in_try_statement = true;
- preferences.insert_new_line_before_else_in_if_statement = true;
- preferences.insert_new_line_before_finally_in_try_statement = true;
- preferences.insert_new_line_before_while_in_do_statement = true;
- preferences.compact_else_if = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test162", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44481
- */
- public void _test163() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.insert_new_line_before_catch_in_try_statement = true;
- preferences.insert_new_line_before_else_in_if_statement = true;
- preferences.insert_new_line_before_finally_in_try_statement = true;
- preferences.insert_new_line_before_while_in_do_statement = true;
- preferences.compact_else_if = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test163", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44493
- */
- public void _test164() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test164", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test165() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test165", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44546
- */
- public void _test166() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test166", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44503
- */
- public void _test167() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test167", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44503
- */
- public void _test169() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test169", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44503
- */
- public void _test170() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test170", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44576
- */
- public void _test171() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.brace_position_for_anonymous_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.compact_else_if = false;
- preferences.insert_new_line_before_catch_in_try_statement = true;
- preferences.insert_new_line_before_else_in_if_statement = true;
- preferences.insert_new_line_before_finally_in_try_statement = true;
- preferences.insert_new_line_before_while_in_do_statement = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test171", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44576
- */
- public void _test172() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.brace_position_for_anonymous_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
- preferences.compact_else_if = false;
- preferences.insert_new_line_before_catch_in_try_statement = true;
- preferences.insert_new_line_before_else_in_if_statement = true;
- preferences.insert_new_line_before_finally_in_try_statement = true;
- preferences.insert_new_line_before_while_in_do_statement = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test172", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44570
- */
- public void _test173() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test173", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44570
- */
- public void _test174() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test174", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44570
- */
- public void _test175() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test175", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44570
- */
- public void _test176() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = true;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test176", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44570
- */
- public void _test177() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test177", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44570
- */
- public void _test178() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = true;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test178", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44570
- */
- public void _test179() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = true;
- preferences.insert_new_line_in_empty_type_declaration = true;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test179", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44570
- */
- public void _test180() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test180", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44651
- */
- public void _test181() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test181", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44651
- */
- public void _test182() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test182", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44653
- */
- public void _test183() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test183", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44653
- */
- public void _test184() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test184", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44653
- */
- public void _test185() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test185", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- */
- public void _test186() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test186", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44839
- */
- public void _test187() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.blank_lines_between_import_groups = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test187", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44839
- */
- public void _test188() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test188", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44839
- */
- public void _test189() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test189", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- */
- public void _test190() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test190", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- */
- public void _test191() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test191", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test192() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.align_type_members_on_columns = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test192", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test193() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test193", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test194() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test194", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test195() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test195", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test196() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test196", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test197() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test197", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test198() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test198", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test199() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test199", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test201() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test201", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * TODO Fix multi local declaration alignment
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44909
- */
- public void _test202() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test202", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * TODO Fix multi local declaration alignment
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44909
- */
- public void _test203() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test203", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test204() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test204", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test205() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");//$NON-NLS-1$
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test205", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test206() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test206", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test207() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test207", "A.js", CodeFormatter.K_STATEMENTS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test208() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test208", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test209() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");//$NON-NLS-1$
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test209", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test210() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");//$NON-NLS-1$
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test210", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test211() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");//$NON-NLS-1$
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test211", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, 1);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test212() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test212", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test213() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test213", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test214() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test214", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test215() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test215", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test216() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test216", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test217() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test217", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test218() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test218", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, 1);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test219() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test219", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, 1);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test220() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test220", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, 1);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test221() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test221", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test222() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test222", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
- public void _test223() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test223", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test224() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test224", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test225() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test225", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test226() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test226", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test227() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test227", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test228() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test228", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test229() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test229", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test230() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test230", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test231() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test231", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test232() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test232", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test233() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test233", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, 1);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test234() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test234", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test235() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test235", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test236() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test236", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test237() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test237", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test238() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test238", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test239() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test239", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test240() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test240", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test241() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test241", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test242() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test242", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test243() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test243", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test244() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test244", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test245() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test245", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test246() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test246", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test247() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test247", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test248() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test248", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test249() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test249", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test250() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test250", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test251() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test251", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test252() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test252", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test253() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test253", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test254() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test254", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test255() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test255", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test256() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test256", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test257() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test257", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test258() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test258", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test259() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test259", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test260() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test260", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test261() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test261", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test262() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test262", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test263() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test263", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test264() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test264", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test265() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test265", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test266() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test266", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test267() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test267", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test268() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test268", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test269() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test269", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test270() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test270", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test271() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test271", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test272() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE, DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test272", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test273() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE, DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test273", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test274() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test274", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test275() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test275", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test276() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test276", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test277() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test277", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test278() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test278", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test279() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test279", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test280() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test280", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test281() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test281", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test282() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test282", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test283() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test283", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test284() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test284", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test285() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test285", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test286() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test286", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test287() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test287", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test288() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test288", "A.js", CodeFormatter.K_STATEMENTS, 1);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test289() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test289", "A.js", CodeFormatter.K_STATEMENTS, 1);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test290() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test290", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test291() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test291", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test292() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test292", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test293() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test293", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test294() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test294", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test295() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test295", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test296() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test296", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test297() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.SPACE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "100");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test297", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test298() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "80");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test298", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test299() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "80");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test299", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test300() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test300", "A.js", CodeFormatter.K_EXPRESSION, 2);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test301() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test301", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test302() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test302", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test303() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.indent_switchstatements_compare_to_cases = true;
- preferences.indent_switchstatements_compare_to_switch = true;
- preferences.indent_breaks_compare_to_cases = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test303", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test304() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.indent_switchstatements_compare_to_cases = true;
- preferences.indent_switchstatements_compare_to_switch = true;
- preferences.indent_breaks_compare_to_cases = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test304", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test305() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.indent_switchstatements_compare_to_cases = false;
- preferences.indent_switchstatements_compare_to_switch = true;
- preferences.indent_breaks_compare_to_cases = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test305", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test306() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.indent_switchstatements_compare_to_cases = true;
- preferences.indent_switchstatements_compare_to_switch = true;
- preferences.indent_breaks_compare_to_cases = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test306", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test307() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.indent_switchstatements_compare_to_cases = true;
- preferences.indent_switchstatements_compare_to_switch = true;
- preferences.indent_breaks_compare_to_cases = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test307", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test308() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.indent_switchstatements_compare_to_cases = false;
- preferences.indent_switchstatements_compare_to_switch = false;
- preferences.indent_breaks_compare_to_cases = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test308", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test309() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.indent_switchstatements_compare_to_cases = false;
- preferences.indent_switchstatements_compare_to_switch = false;
- preferences.indent_breaks_compare_to_cases = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test309", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test310() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test310", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test311() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test311", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test312() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test312", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test313() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test313", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void test314() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test314", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test315() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- String source = "public final void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {\n" +
- "/*\n" +
- " \n" +
- "*/\n" +
- "}";
- String expectedResult = "public final void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {\r\n" +
- " /*\r\n" +
- " \r\n" +
- " */\r\n" +
- "}";
- runTest(source, expectedResult, codeFormatter, CodeFormatter.K_CLASS_BODY_DECLARATIONS, 0, false, 0, -1);
- }
-
- public void _test316() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- String source = "public final void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {\r" +
- "/*\r" +
- " \r" +
- "*/\r" +
- "}";
- String expectedResult = "public final void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {\r\n" +
- " /*\r\n" +
- " \r\n" +
- " */\r\n" +
- "}";
- runTest(source, expectedResult, codeFormatter, CodeFormatter.K_CLASS_BODY_DECLARATIONS, 0, false, 0, -1);
- }
-
- public void _test317() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.line_separator = "\n";
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- String source = "public final void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {\r\n" +
- "/*\r\n" +
- " \r\n" +
- "*/\r\n" +
- "}";
- String expectedResult = "public final void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {\n" +
- " /*\n" +
- " \n" +
- " */\n" +
- "}";
- runTest(source, expectedResult, codeFormatter, CodeFormatter.K_CLASS_BODY_DECLARATIONS, 0, false, 0, -1);
- }
-
- public void _test318() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.line_separator = "\r";
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- String source = "public final void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {\r" +
- "/*\r" +
- " \r" +
- "*/\r" +
- "}";
- String expectedResult = "public final void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {\r" +
- " /*\r" +
- " \r" +
- " */\r" +
- "}";
- runTest(source, expectedResult, codeFormatter, CodeFormatter.K_CLASS_BODY_DECLARATIONS, 0, false, 0, -1);
- }
-
- public void _test319() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test319", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test320() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test320", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test321() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test321", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test322() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test322", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test323() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_anonymous_type_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = false;
- preferences.insert_new_line_in_empty_method_body = false;
- preferences.insert_new_line_in_empty_block = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test323", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=45141
- */
- public void _test324() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test324", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=45220
- */
- public void _test325() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test325", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=45465
- */
- public void _test326() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test326", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=45508
- */
- public void _test327() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test327", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=22073
- */
- public void _test328() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test328", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=29473
- */
- public void _test329() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test329", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=27249
- */
- public void _test330() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.keep_empty_array_initializer_on_one_line = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test330", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=23709
- */
- public void _test331() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test331", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=23709
- */
- public void _test332() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test332", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=45968
- */
- public void _test333() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 5;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test333", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46058
- */
- public void _test334() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.put_empty_statement_on_new_line = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test334", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46033
- */
- public void _test335() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test335", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46023
- */
- public void _test336() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test336", "A.js", CodeFormatter.K_STATEMENTS, 8);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46150
- */
- public void _test337() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test337", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46686
- */
- public void _test338() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test338", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46686
- */
- public void _test339() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test339", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46686
- */
- public void _test340() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test340", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46689
- */
- public void _test341() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_unary_operator = false;
- preferences.insert_space_after_assignment_operator = false;
- preferences.insert_space_after_binary_operator = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test341", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46690
- */
- public void _test342() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_comma_in_multiple_local_declarations = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test342", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46690
- */
- public void _test343() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_comma_in_multiple_field_declarations = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test343", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46690
- */
- public void _test344() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_comma_in_multiple_field_declarations = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test344", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46690
- */
- public void _test345() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_comma_in_multiple_local_declarations = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test345", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44493
- */
- public void _test347() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- assertEquals(DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.getWrappingStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION)));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.blank_lines_before_method = 1;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.insert_new_line_in_empty_method_body = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test347", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44493
- */
- public void _test348() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.blank_lines_before_method = 1;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.insert_new_line_in_empty_method_body = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test348", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44493
- */
- public void _test349() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getJavaConventionsSettings());
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test349", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44653
- */
- public void _test350() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test350", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44765
- */
- public void test351() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test351", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44653
- */
- public void test352() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getJavaConventionsSettings());
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test352", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44642
- */
- public void test353() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test353", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47799
- */
- public void _test354() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, DefaultCodeFormatterConstants.FALSE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test354", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47799
- */
- public void _test355() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, DefaultCodeFormatterConstants.TRUE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test355", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47800
- */
- public void _test356() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION, DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test356", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47801
- */
- public void test357() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test357", "A.js", CodeFormatter.K_EXPRESSION);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47801
- */
- public void test358() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test358", "A.js", CodeFormatter.K_EXPRESSION);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47811
- */
- public void _test359() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test359", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47811
- */
- public void _test360() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "2");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test360", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47811
- */
- public void _test361() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test361", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47802
- */
- public void _test362() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.page_width = 57;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test362", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47800
- */
- public void _test363() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test363", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47986
- */
- public void _test364() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_comma_in_for_inits = false;
- preferences.insert_space_after_comma_in_for_increments = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test364", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47986
- */
- public void _test365() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_comma_in_for_inits = false;
- preferences.insert_space_after_comma_in_for_increments = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test365", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47986
- */
- public void _test366() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_comma_in_for_inits = true;
- preferences.insert_space_before_comma_in_for_inits = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test366", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47986
- */
- public void _test367() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_after_comma_in_for_inits = true;
- preferences.insert_space_before_comma_in_for_inits = true;
- preferences.insert_space_after_comma_in_multiple_local_declarations = false;
- preferences.insert_space_before_comma_in_multiple_local_declarations = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test367", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47918
- */
- public void _test368() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, "0");
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test368", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47918
- */
- public void _test369() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "0");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION, "1");
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test369", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47918
- */
- public void _test370() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION, "1");
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test370", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47918
- */
- public void _test371() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, "0");
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test371", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47918
- */
- public void _test372() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, "0");
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test372", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47918
- */
- public void _test373() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "0");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION, "1");
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test373", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44813
- */
- public void _test374() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test374", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44813
- */
- public void _test375() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test375", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44813
- */
- public void _test376() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test376", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44813
- */
- public void _test377() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test377", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44813
- */
- public void _test378() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, DefaultCodeFormatterConstants.END_OF_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test378", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47997
- */
- public void _test379() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test379", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47997
- */
- public void _test380() {
- Hashtable options = new Hashtable();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.SPACE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "100");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test380", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47997
- */
- public void _test381() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "0");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION, "0");
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test381", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48131
- */
- public void _test382() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(new DefaultCodeFormatterOptions(options));
- runTest(codeFormatter, "test382", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48141
- */
- public void _test383() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- preferences.blank_lines_before_first_class_body_declaration = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test383", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48143
- */
- public void _test384() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test384", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48143
- */
- public void _test385() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_NEXT_SHIFTED, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- assertEquals(DefaultCodeFormatterConstants.WRAP_NEXT_SHIFTED, DefaultCodeFormatterConstants.getWrappingStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION)));
- assertTrue(DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE != DefaultCodeFormatterConstants.getWrappingStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION)));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_before_first_class_body_declaration = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test385", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48143
- */
- public void _test386() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_before_first_class_body_declaration = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test386", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48143
- */
- public void _test387() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
-// options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "40");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.page_width = 40;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test387", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48167
- */
- public void _test388() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- preferences.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.page_width = 40;
- preferences.insert_new_line_after_opening_brace_in_array_initializer = true;
- preferences.insert_new_line_before_closing_brace_in_array_initializer = true;
- preferences.blank_lines_before_first_class_body_declaration = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test388", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48167
- */
- public void _test389() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.continuation_indentation_for_array_initializer = 1;
- preferences.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.page_width = 40;
- preferences.insert_new_line_after_opening_brace_in_array_initializer = true;
- preferences.insert_new_line_before_closing_brace_in_array_initializer = true;
- preferences.blank_lines_before_first_class_body_declaration = 0;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test389", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48167
- */
- public void _test390() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT_FIRST_BREAK, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.continuation_indentation_for_array_initializer = 1;
- preferences.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.page_width = 40;
- preferences.insert_new_line_after_opening_brace_in_array_initializer = true;
- preferences.insert_new_line_before_closing_brace_in_array_initializer = true;
- preferences.blank_lines_before_first_class_body_declaration = 0;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test390", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48167
- */
- public void _test391() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_BY_ONE));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_before_first_class_body_declaration = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.continuation_indentation_for_array_initializer = 3;
- preferences.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.page_width = 40;
- preferences.insert_new_line_after_opening_brace_in_array_initializer = true;
- preferences.insert_new_line_before_closing_brace_in_array_initializer = true;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test391", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48167
- */
- public void _test392() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_BY_ONE));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_before_first_class_body_declaration = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.continuation_indentation_for_array_initializer = 3;
- preferences.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- preferences.page_width = 40;
- preferences.insert_new_line_after_opening_brace_in_array_initializer = true;
- preferences.insert_new_line_before_closing_brace_in_array_initializer = true;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test392", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48167
- */
- public void _test393() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.blank_lines_before_first_class_body_declaration = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.continuation_indentation_for_array_initializer = 1;
- preferences.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- preferences.page_width = 40;
- preferences.insert_new_line_after_opening_brace_in_array_initializer = true;
- preferences.insert_new_line_before_closing_brace_in_array_initializer = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test393", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48404
- */
- public void _test394() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test394", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49318
- */
- public void _test395() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.insert_space_before_opening_paren_in_method_declaration = true;
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test395", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49243
- */
- public void _test396() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.insert_space_before_semicolon_in_for = true;
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test396", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
- */
- public void _test397() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_before_package = 2;
- preferences.blank_lines_after_package = 0;
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test397", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
- */
- public void _test398() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.blank_lines_before_package = 0;
- preferences.blank_lines_after_package = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test398", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
- */
- public void _test399() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_before_package = 1;
- preferences.blank_lines_after_package = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test399", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
- */
- public void _test400() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_PACKAGE, "2");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_PACKAGE, "2");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test400", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49361
- */
- public void _test401() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test401", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49361
- */
- public void _test402() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test402", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49298
- */
- public void _test403() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test403", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49298
- */
- public void _test404() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test404", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
- */
- public void _test405() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_PACKAGE, "10");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test405", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49298
- */
- public void _test406() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test406", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49481
- */
- public void _test407() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.blank_lines_before_first_class_body_declaration = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test407", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49481
- */
- public void _test408() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.blank_lines_before_first_class_body_declaration = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test408", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49378
- */
- public void test409() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE, DefaultCodeFormatterConstants.NEXT_LINE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.indent_switchstatements_compare_to_cases = false;
- preferences.indent_switchstatements_compare_to_switch = true;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_switch = DefaultCodeFormatterConstants.NEXT_LINE;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test409", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49577
- */
- public void _test410() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_between_type_declarations = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test410", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49577
- */
- public void _test411() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_between_type_declarations = 2;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test411", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49551
- */
- public void _test412() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test412", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49551
- */
- public void _test413() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_between_type_declarations = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test413", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49551
- */
- public void _test414() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test414", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49551
- */
- public void _test415() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_between_type_declarations = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test415", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49551
- */
- public void _test416() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_between_type_declarations = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test416", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49571
- */
- public void _test417() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_opening_paren_in_constructor_declaration = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test417", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49571
- */
- public void _test418() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_opening_paren_in_constructor_declaration = true;
- preferences.insert_space_before_opening_paren_in_method_declaration = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test418", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49162
- */
- public void _test419() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test419", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49623
- */
- public void _test420() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.align_type_members_on_columns = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test420", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49298
- */
- public void _test421() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test421", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49298
- */
- public void _test422() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test422", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49351
- */
- public void _test423() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.END_OF_LINE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test423", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49351
- */
- public void _test424() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test424", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49351
- */
- public void _test425() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test425", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49351
- */
- public void _test426() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test426", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49351
- */
- public void _test427() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test427", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49351
- */
- public void _test428() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test428", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49351
- */
- public void _test429() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test429", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49351
- */
- public void _test430() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test430", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49351
- */
- public void _test431() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test431", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49370
- */
- public void _test432() {
- String resourcePath = getResource("test432", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "AIS");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test432", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49370
- */
- public void _test433() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test433", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49660
- */
- public void _test434() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- assertEquals(true, DefaultCodeFormatterConstants.getForceWrapping((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION)));
- assertEquals(DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.getWrappingStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION)));
- assertEquals(DefaultCodeFormatterConstants.INDENT_ON_COLUMN, DefaultCodeFormatterConstants.getIndentStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION)));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 3;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.insert_space_after_opening_paren_in_method_invocation = true;
- preferences.insert_space_before_closing_paren_in_method_invocation = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test434", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49772
- */
- public void _test435() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test435", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49772
- */
- public void _test436() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test436", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49660
- */
- public void _test437() {
- String resourcePath = getResource("test437", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "Felix");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test437", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49660
- */
- public void _test438() {
- String resourcePath = getResource("test438", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "Felix");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test438", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49660
- */
- public void _test439() {
- String resourcePath = getResource("test439", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "Felix");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test439", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49763
- */
- public void _test440() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, DefaultCodeFormatterConstants.FALSE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test440", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49763
- */
- public void _test441() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, DefaultCodeFormatterConstants.FALSE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test441", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49763
- */
- public void _test442() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, DefaultCodeFormatterConstants.FALSE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test442", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49763
- */
- public void _test443() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test443", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49763
- */
- public void _test444() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, DefaultCodeFormatterConstants.FALSE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test444", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49763
- */
- public void _test445() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, DefaultCodeFormatterConstants.FALSE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test445", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49327
- */
- public void _test446() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test446", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
- */
- public void _test447() {
- String resourcePath = getResource("test447", "test447.zip");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "settings.xml", "Toms");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- String input = getZipEntryContents(resourcePath, getIn("Format.js"));
- assertNotNull("No input", input);
- String output = getZipEntryContents(resourcePath, getOut("Format.js"));
- assertNotNull("No output", output);
- int start = input.indexOf("private");
- int end = input.indexOf(";");
- runTest(input, output, codeFormatter, CodeFormatter.K_JAVASCRIPT_UNIT, 0, false, start, end - start + 1, "\r\n");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49953
- */
- public void _test448() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_space_before_opening_bracket_in_array_allocation_expression = true;
- preferences.insert_space_after_opening_bracket_in_array_allocation_expression = true;
- preferences.insert_space_before_closing_bracket_in_array_allocation_expression = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test448", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49953
- */
- public void _test449() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.number_of_empty_lines_to_preserve = 0;
- preferences.insert_space_before_opening_bracket_in_array_allocation_expression = false;
- preferences.insert_space_after_opening_bracket_in_array_allocation_expression = true;
- preferences.insert_space_before_closing_bracket_in_array_allocation_expression = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test449", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50225
- */
- public void test450() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test450", "A.js", CodeFormatter.K_UNKNOWN, 0, false, 0, 0);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
- */
- public void _test451() {
- String resourcePath = getResource("test451", "test451.zip");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "settings.xml", "Toms");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- String input = getZipEntryContents(resourcePath, getIn("Format.js"));
- assertNotNull("No input", input);
- String output = getZipEntryContents(resourcePath, getOut("Format.js"));
- assertNotNull("No output", output);
- int start = input.indexOf("private");
- int end = input.indexOf(";");
- runTest(input, output, codeFormatter, CodeFormatter.K_JAVASCRIPT_UNIT, 0, false, start, end - start + 1, "\r\n");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
- */
- public void _test452() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_PACKAGE, "2");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_PACKAGE, "2");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test452", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50719
- */
- public void _test453() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test453", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50736
- */
- public void _test454() {
- String resourcePath = getResource("test454", "test454.zip");
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");//$NON-NLS-1$
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- String input = getZipEntryContents(resourcePath, getIn("A.js"));
- assertNotNull("No input", input);
- String output = getZipEntryContents(resourcePath, getOut("A.js"));
- assertNotNull("No output", output);
- int start = input.indexOf("launch.setAttribute");
- int end = input.indexOf(";", start + 1);
- runTest(input, output, codeFormatter, CodeFormatter.K_JAVASCRIPT_UNIT, 0, false, start, end - start + 1, "\r\n");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50736
- */
- public void _test455() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");//$NON-NLS-1$
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test455", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50736
- */
- public void _test456() {
- String resourcePath = getResource("test456", "test456.zip");
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- String input = getZipEntryContents(resourcePath, getIn("A.js"));
- assertNotNull("No input", input);
- String output = getZipEntryContents(resourcePath, getOut("A.js"));
- assertNotNull("No output", output);
- int start = input.indexOf("launch.setAttribute");
- int end = input.indexOf(";", start + 1);
- runTest(input, output, codeFormatter, CodeFormatter.K_JAVASCRIPT_UNIT, 0, false, start, end - start + 1, "\r\n");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50989
- */
- public void _test457() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test457", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check null options
- */
- public void _test458() {
- CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(null);
- runTest(codeFormatter, "test458", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51158
- */
- public void test459() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- true,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_BY_ONE
- ));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- false,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_BY_ONE
- ));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test459", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51158
- */
- public void _test460() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- false,
- DefaultCodeFormatterConstants.WRAP_COMPACT,
- DefaultCodeFormatterConstants.INDENT_BY_ONE
- ));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test460", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51190
- */
- public void _test461() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test461", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51158
- */
- public void test462() {
- String resourcePath = getResource("test462", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "neils");
- assertNotNull("No preferences", options);
-
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- true,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test462", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50276
- */
- public void _test463() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- false,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test463", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51128
- */
- public void _test464() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK, DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
-
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test464", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44642
- * @deprecated
- */
- public void _test465() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- false,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_BY_ONE));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- false,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_BY_ONE));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test465", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44642
- * @deprecated
- */
- public void _test466() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- false,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_BY_ONE));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- true,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_BY_ONE));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test466", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44642
- * @deprecated
- */
- public void _test467() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- false,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_BY_ONE));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- false,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_BY_ONE));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test467", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51128
- */
- public void _test468() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");//$NON-NLS-1$
-
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test468", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51201
- */
- public void _test469() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE);
-
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test469", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51035
- */
- public void _test470() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test470", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51659
- */
- public void _test471() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test471", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51659
- */
- public void _test472() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test472", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51659
- */
- public void _test473() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test473", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51659
- */
- public void _test474() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test474", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51659
- */
- public void _test475() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test475", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51768
- */
- public void _test476() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER, DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK, DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY, DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_IMPORTS, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test476", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51603
- */
- public void test477() {
- String option =
- DefaultCodeFormatterConstants.createAlignmentValue(
- true,
- DefaultCodeFormatterConstants.WRAP_NO_SPLIT,
- DefaultCodeFormatterConstants.INDENT_BY_ONE);
- assertTrue("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_NO_SPLIT, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_BY_ONE, DefaultCodeFormatterConstants.getIndentStyle(option));
-
- option = DefaultCodeFormatterConstants.setForceWrapping(option, false);
- assertFalse("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_NO_SPLIT, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_BY_ONE, DefaultCodeFormatterConstants.getIndentStyle(option));
-
- option = DefaultCodeFormatterConstants.setIndentStyle(option, DefaultCodeFormatterConstants.INDENT_ON_COLUMN);
- assertFalse("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_NO_SPLIT, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_ON_COLUMN, DefaultCodeFormatterConstants.getIndentStyle(option));
-
-
- option = DefaultCodeFormatterConstants.setIndentStyle(option, DefaultCodeFormatterConstants.INDENT_DEFAULT);
- assertFalse("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_NO_SPLIT, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_DEFAULT, DefaultCodeFormatterConstants.getIndentStyle(option));
-
-
- option = DefaultCodeFormatterConstants.setForceWrapping(option, true);
- assertTrue("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_NO_SPLIT, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_DEFAULT, DefaultCodeFormatterConstants.getIndentStyle(option));
-
-
- option = DefaultCodeFormatterConstants.setWrappingStyle(option, DefaultCodeFormatterConstants.WRAP_COMPACT);
- assertTrue("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_DEFAULT, DefaultCodeFormatterConstants.getIndentStyle(option));
-
-
- option = DefaultCodeFormatterConstants.setWrappingStyle(option, DefaultCodeFormatterConstants.WRAP_COMPACT_FIRST_BREAK);
- assertTrue("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_COMPACT_FIRST_BREAK, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_DEFAULT, DefaultCodeFormatterConstants.getIndentStyle(option));
-
- option = DefaultCodeFormatterConstants.setWrappingStyle(option, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE);
- assertTrue("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_DEFAULT, DefaultCodeFormatterConstants.getIndentStyle(option));
-
- option = DefaultCodeFormatterConstants.setWrappingStyle(option, DefaultCodeFormatterConstants.WRAP_NEXT_SHIFTED);
- assertTrue("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_NEXT_SHIFTED, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_DEFAULT, DefaultCodeFormatterConstants.getIndentStyle(option));
-
- option = DefaultCodeFormatterConstants.setWrappingStyle(option, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE);
- assertTrue("Wrong force setting", DefaultCodeFormatterConstants.getForceWrapping(option));
- assertEquals("Wrong wrapping style", DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.getWrappingStyle(option));
- assertEquals("Wrong indent style", DefaultCodeFormatterConstants.INDENT_DEFAULT, DefaultCodeFormatterConstants.getIndentStyle(option));
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52246
- */
- public void _test478() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, options);
- runTest(codeFormatter, "test478", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52479
- */
- public void _test479() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test479", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52479
- */
- public void _test480() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test480", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52283
- */
- public void _test481() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test481", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52283
- */
- public void _test482() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test482", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52851
- */
- public void _test483() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test483", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50989
- */
- public void _test484() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");//$NON-NLS-1$
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test484", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50989
- */
- public void _test485() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");//$NON-NLS-1$
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test485", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50989
- */
- public void _test486() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);//$NON-NLS-1$
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, DefaultCodeFormatterConstants.NEXT_LINE);//$NON-NLS-1$
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);//$NON-NLS-1$
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);//$NON-NLS-1$
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.NEXT_LINE);//$NON-NLS-1$
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE);//$NON-NLS-1$
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test486", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test487() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test487", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test488() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test488", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test489() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test489", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52747
- */
- public void _test490() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, DefaultCodeFormatterConstants.NEXT_LINE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE);
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test490", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59451
- */
- public void _test491() {
- String resourcePath = getResource("test491", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "DOI");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test491", "BundleChain.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59575
- */
- public void _test492() {
- String resourcePath = getResource("test492", "core_formatting.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "core");
- assertNotNull("No preferences", options);
- options.put(JavaScriptCore.COMPILER_PB_NON_NLS_STRING_LITERAL, JavaScriptCore.ERROR);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, options);
- runTest(codeFormatter, "test492", "Main.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59716
- */
- public void _test493() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_PACKAGE, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_PACKAGE, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_IMPORTS, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_IMPORTS, "1");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test493", "MyClass.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60035
- */
- public void _test494() {
- String resourcePath = getResource("test494", "format.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "AGPS default");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, options);
- runTest(codeFormatter, "test494", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=58565
- */
- public void _test495() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test495", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=58565
- */
- public void _test496() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test496", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test497() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test497", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test498() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test498", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test499() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.blank_lines_before_first_class_body_declaration = 1;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test499", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test500() {
- Map options = DefaultCodeFormatterConstants.getEclipse21Settings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test500", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=68506
- */
- public void _test501() {
- String resourcePath = getResource("test501", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "GMTI");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test501", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=69806
- */
- public void _test502() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test502", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Formatting foreach
- */
- public void _test503() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test503", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Formatting parameterized type
- */
- public void _test504() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test504", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * Formatting parameterized type
- */
- public void _test505() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test505", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * Formatting parameterized type
- */
- public void _test506() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test506", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * Formatting enum declaration
- */
- public void _test507() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test507", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * Formatting annotation type declaration
- */
- public void _test508() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test508", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=68506
- */
- public void _test509() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.compact_else_if = true;
- preferences.insert_new_line_at_end_of_file_if_missing = true;
- preferences.number_of_empty_lines_to_preserve = 0;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter,"test509", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=68506
- */
- public void _test510() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.compact_else_if = true;
- preferences.insert_new_line_at_end_of_file_if_missing = false;
- preferences.number_of_empty_lines_to_preserve = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter,"test510", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=68506
- */
- public void _test511() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.compact_else_if = true;
- preferences.insert_new_line_at_end_of_file_if_missing = false;
- preferences.number_of_empty_lines_to_preserve = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter,"test511", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=68506
- */
- public void _test512() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipse21Settings());
- preferences.keep_simple_if_on_one_line = true;
- preferences.keep_then_statement_on_same_line = true;
- preferences.keep_guardian_clause_on_one_line = true;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.compact_else_if = true;
- preferences.insert_new_line_at_end_of_file_if_missing = true;
- preferences.number_of_empty_lines_to_preserve = 1;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter,"test512", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=73371
- */
- public void _test513() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test513", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=75488
- */
- public void _test514() {
- String resourcePath = getResource("test514", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "core");
- assertNotNull("No preferences", options);
- options.put(JavaScriptCore.COMPILER_PB_NON_NLS_STRING_LITERAL, JavaScriptCore.ERROR);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, options);
- runTest(codeFormatter, "test514", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=75720
- */
- public void _test515() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test515", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=75720
- */
- public void _test516() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test516", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=75720
- */
- public void _test517() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test517", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=75720
- */
- public void _test518() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test518", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=75720
- */
- public void _test519() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test519", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * Formatting enum declaration
- */
- public void _test520() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test520", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76642
- */
- public void _test521() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test521", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76642
- */
- public void _test522() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test522", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76766
- */
- public void _test523() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_type_declaration = true;
- preferences.insert_new_line_in_empty_enum_constant = false;
- preferences.insert_new_line_in_empty_enum_declaration = false;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test523", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76766
- */
- public void _test524() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_type_declaration = true;
- preferences.insert_new_line_in_empty_enum_constant = false;
- preferences.insert_new_line_in_empty_enum_declaration = true;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test524", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76766
- */
- public void _test525() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_type_declaration = true;
- preferences.insert_new_line_in_empty_enum_constant = true;
- preferences.insert_new_line_in_empty_enum_declaration = false;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test525", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76766
- */
- public void _test526() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.insert_new_line_in_empty_type_declaration = true;
- preferences.insert_new_line_in_empty_enum_constant = true;
- preferences.insert_new_line_in_empty_enum_declaration = true;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test526", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77249
- */
- public void _test527() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test527", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79779
- */
- public void _test528() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test528", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79779
- */
- public void _test529() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test529", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79795
- */
- public void _test530() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test530", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79795
- */
- public void _test531() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test531", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79795
- */
- public void _test532() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test532", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79795
- */
- public void _test533() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test533", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78698
- */
- public void _test534() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test534", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78698
- */
- public void _test535() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test535", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83078
- */
- public void _test538() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getJavaConventionsSettings());
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter,"test538", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83515
- */
- public void _test539() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test539", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83515
- */
- public void _test540() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test540", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83684
- */
- public void _test541() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test541", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- public void _test542() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getJavaConventionsSettings());
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test542", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void _test543() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getJavaConventionsSettings());
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test543", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=86410
- */
- public void _test544() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.insert_space_after_closing_angle_bracket_in_type_parameters = true;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test544", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=86878
- */
- public void _test545() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test545", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=86908
- */
- public void _test546() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test546", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Add support for comment formatting
- */
- public void test547() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test547", "A.js", CodeFormatter.K_MULTI_LINE_COMMENT, false);//$NON-NLS-1$ //$NON-NLS-2$
-
- runTest(codeFormatter, "test547", "A.js", CodeFormatter.K_UNKNOWN, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Add support for comment formatting
- */
- public void test548() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test548", "A.js", CodeFormatter.K_JAVA_DOC, false);//$NON-NLS-1$ //$NON-NLS-2$
-
- runTest(codeFormatter, "test548", "A.js", CodeFormatter.K_UNKNOWN, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=73104
- public void _test549() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.MIXED;
- preferences.indentation_size = 4;
- preferences.tab_size = 8;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test549", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=73104
- public void _test550() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.MIXED;
- preferences.indentation_size = 4;
- preferences.tab_size = 8;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test550", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=73104
- public void _test551() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- assertEquals(false, DefaultCodeFormatterConstants.getForceWrapping((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION)));
- assertEquals(DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.getWrappingStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION)));
- assertEquals(DefaultCodeFormatterConstants.INDENT_ON_COLUMN, DefaultCodeFormatterConstants.getIndentStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION)));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.MIXED;
- preferences.indentation_size = 4;
- preferences.tab_size = 8;
- preferences.page_width = 57;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test551", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=73104
- public void _test552() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- assertEquals(false, DefaultCodeFormatterConstants.getForceWrapping((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION)));
- assertEquals(DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.getWrappingStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION)));
- assertEquals(DefaultCodeFormatterConstants.INDENT_ON_COLUMN, DefaultCodeFormatterConstants.getIndentStyle((String) options.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION)));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.MIXED;
- preferences.indentation_size = 4;
- preferences.tab_size = 8;
- preferences.page_width = 57;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test552", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Add support for comment formatting
- */
- public void test553() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test553", "A.js", CodeFormatter.K_SINGLE_LINE_COMMENT, false);//$NON-NLS-1$ //$NON-NLS-2$
-
- runTest(codeFormatter, "test553", "A.js", CodeFormatter.K_UNKNOWN, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Add support for comment formatting
- */
- public void test554() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test554", "A.js", CodeFormatter.K_SINGLE_LINE_COMMENT, false);//$NON-NLS-1$ //$NON-NLS-2$
-
- runTest(codeFormatter, "test554", "A.js", CodeFormatter.K_UNKNOWN, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=73104
- public void _test555() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.MIXED;
- preferences.indentation_size = 4;
- preferences.tab_size = 8;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test555", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * Empty array initializer formatting
- */
- public void _test556() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test556", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * Empty array initializer formatting
- */
- public void _test557() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.keep_empty_array_initializer_on_one_line = true;
- preferences.insert_space_between_empty_braces_in_array_initializer = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test557", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=89302
- public void _test558() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.insert_space_after_comma_in_enum_declarations = false;
- preferences.insert_new_line_after_annotation = false;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test558", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=89302
- public void _test559() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.insert_space_after_comma_in_enum_declarations = true;
- preferences.insert_new_line_after_annotation = false;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test559", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=81497
- public void _test560() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.keep_empty_array_initializer_on_one_line = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test560", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=81497
- public void _test561() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- preferences.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.keep_empty_array_initializer_on_one_line = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test561", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=89318
- public void _test562() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- preferences.insert_space_after_closing_angle_bracket_in_type_arguments = false;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test562", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=89318
- public void _test563() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.insert_space_after_closing_angle_bracket_in_type_arguments = true;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test563", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=89299
- public void _test564() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 4;
- preferences.brace_position_for_array_initializer = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_block = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.keep_empty_array_initializer_on_one_line = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test564", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*// https://bugs.eclipse.org/bugs/show_bug.cgi?id=49896
- public void _test565() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.use_tabs_only_for_leading_indentations = true;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test565", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }*/
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=73658
- public void _test566() {
- Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.brace_position_for_enum_constant = DefaultCodeFormatterConstants.NEXT_LINE;
- preferences.brace_position_for_enum_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test566", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49896
- public void _test567() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.use_tabs_only_for_leading_indentations = true;
- preferences.page_width = 35;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test567", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49896
- public void _test568() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.indentation_size = 4;
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.MIXED;
- preferences.use_tabs_only_for_leading_indentations = true;
- preferences.page_width = 35;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test568", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49896
- public void _test569() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.indentation_size = 4;
- preferences.tab_size = 4;
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.use_tabs_only_for_leading_indentations = false;
- preferences.page_width = 40;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test569", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=77809
- public void _test570() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test570", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=77809
- public void _test571() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test571", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=90213
- public void _test572() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.insert_space_after_opening_brace_in_array_initializer = false;
- preferences.insert_space_before_closing_brace_in_array_initializer = false;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test572", "A.js", CodeFormatter.K_STATEMENTS, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=90213
- public void _test573() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test573", "A.js", CodeFormatter.K_STATEMENTS, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=91238
- public void test574() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test574", "A.js", CodeFormatter.K_JAVA_DOC, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=77809
- public void _test575() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test575", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=95431
- public void _test576() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test576", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=98037
- public void _test577() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test577", "A.js", CodeFormatter.K_UNKNOWN, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=98037
- public void _test578() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test578", "A.js", CodeFormatter.K_UNKNOWN, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=98139
- public void _test579() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test579", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=98139
- public void _test580() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test580", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=99084
- public void _test581() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test581", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=99084
- public void _test582() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.insert_space_after_closing_angle_bracket_in_type_arguments = false;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test582", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=100062
- public void _test583() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test583", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49896
- public void _test584() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, DefaultCodeFormatterConstants.MIXED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "65");
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test584", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49896
- public void _test585() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, DefaultCodeFormatterConstants.MIXED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "80");
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test585", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49896
- public void _test586() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "65");
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test586", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49896
- public void _test587() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "80");
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test587", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=101230
- public void _test588() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test588", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=104796
- public void _test589() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test589", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=103706
- public void _test590() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, DefaultCodeFormatterConstants.TRUE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test590", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=103706
- public void _test591() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, DefaultCodeFormatterConstants.FALSE);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test591", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=98089
- public void _test592() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "60");
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.SPACE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test592", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=71766
- public void _test593() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NO_SPLIT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test593", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=71766
- public void _test594() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test594", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=71766
- public void _test595() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test595", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=71766
- public void _test596() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test596", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87193
- public void _test597() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, DefaultCodeFormatterConstants.MIXED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "60");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test597", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87193
- public void _test598() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "60");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test598", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87193
- public void _test599() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
- DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "60");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test599", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // test Scribe2.hasNLSTag()
- public void _test600() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test600", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // Binary expression
- public void _test601() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT));
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "60");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test601", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=108916
- public void _test605() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS,
- DefaultCodeFormatterConstants.createAlignmentValue(
- true,
- DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test605", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=110304
- public void _test606() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test606", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=111270
- public void _test607() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test607", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=111270
- public void _test608() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test608", "A.js", CodeFormatter.K_JAVA_DOC, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=116858
- public void _test609() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.indent_switchstatements_compare_to_cases = true;
- preferences.indent_switchstatements_compare_to_switch = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test609", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=122914
- */
- public void _test610() {
- String resourcePath = getResource("test610", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "mhdk");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test610", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=111446
- */
- public void test611() {
- {
- // only tabs, indentation size = 4, tab size = 4
- // indentation size is ignored
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 4;
- preferences.indentation_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- assertEquals("Wrong indentation string", "\t", codeFormatter.createIndentationString(1));
- assertEquals("Wrong indentation string", "\t\t", codeFormatter.createIndentationString(2));
- assertEquals("Wrong indentation string", "\t\t\t", codeFormatter.createIndentationString(3));
- }
- {
- // only tabs, indentation size = 4, tab size = 8
- // indentation size is ignored
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.TAB;
- preferences.tab_size = 8;
- preferences.indentation_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- assertEquals("Wrong indentation string", "\t", codeFormatter.createIndentationString(1));
- assertEquals("Wrong indentation string", "\t\t", codeFormatter.createIndentationString(2));
- assertEquals("Wrong indentation string", "\t\t\t", codeFormatter.createIndentationString(3));
- }
- {
- // only spaces, indentation size = 4, tab size = 2
- // indentation size is ignored
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.SPACE;
- preferences.tab_size = 2;
- preferences.indentation_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- assertEquals("Wrong indentation string", " ", codeFormatter.createIndentationString(1));
- assertEquals("Wrong indentation string", " ", codeFormatter.createIndentationString(2));
- assertEquals("Wrong indentation string", " ", codeFormatter.createIndentationString(3));
- }
- {
- // mixed, indentation size = 4, tab size = 2
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.MIXED;
- preferences.tab_size = 2;
- preferences.indentation_size = 4;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- assertEquals("Wrong indentation string", "\t\t", codeFormatter.createIndentationString(1));
- assertEquals("Wrong indentation string", "\t\t\t\t", codeFormatter.createIndentationString(2));
- }
- {
- // mixed, indentation size = 2, tab size = 4
- // indentation size is ignored
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.tab_char = DefaultCodeFormatterOptions.MIXED;
- preferences.tab_size = 4;
- preferences.indentation_size = 2;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- assertEquals("Wrong indentation string", " ", codeFormatter.createIndentationString(1));
- assertEquals("Wrong indentation string", "\t", codeFormatter.createIndentationString(2));
- assertEquals("Wrong indentation string", "\t ", codeFormatter.createIndentationString(3));
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=126625
- public void _test612() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.indent_body_declarations_compare_to_annotation_declaration_header = false;
- preferences.indent_body_declarations_compare_to_type_header = true;
- preferences.insert_new_line_in_empty_annotation_declaration = false;
- preferences.insert_new_line_in_empty_type_declaration = true;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test612", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=126625
- public void _test613() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.indent_body_declarations_compare_to_annotation_declaration_header = true;
- preferences.indent_body_declarations_compare_to_type_header = false;
- preferences.insert_new_line_in_empty_annotation_declaration = true;
- preferences.insert_new_line_in_empty_type_declaration = false;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test613", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=128848
- public void _test614() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test614", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=128848
- public void _test615() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test615", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=128848
- public void _test616() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test616", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=131013
- public void _test617() {
- String resourcePath = getResource("test617", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "JRK");
- assertNotNull("No preferences", options);
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- true,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test617", "A.js", CodeFormatter.K_STATEMENTS);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=137224
- public void _test618() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test618", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=137224
- public void _test619() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test619", "A.js", CodeFormatter.K_CLASS_BODY_DECLARATIONS, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=139291
- public void _test620() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test620", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=139291
- public void _test621() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test621", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=148370
- public void _test622() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test622", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=148370
- public void _test623() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test623", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=148370
- public void _test624() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test624", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=102728
- public void _test625() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(
- DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION,
- DefaultCodeFormatterConstants.createAlignmentValue(
- true,
- DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
- DefaultCodeFormatterConstants.INDENT_DEFAULT));
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test625", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=152725
- public void _test626() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test626", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=158267
- public void _test627() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test627", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=158267
- public void _test628() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test628", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=158267
- public void _test629() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- preferences.brace_position_for_type_declaration = DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP;
- Hashtable javaCoreOptions = JavaScriptCore.getOptions();
- try {
- Hashtable newJavaCoreOptions = JavaScriptCore.getOptions();
- newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- JavaScriptCore.setOptions(newJavaCoreOptions);
-
- Map compilerOptions = new HashMap();
- compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions);
- runTest(codeFormatter, "test629", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- JavaScriptCore.setOptions(javaCoreOptions);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=158267
- public void _test630() {
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getEclipseDefaultSettings());
- preferences.insert_space_after_opening_paren_in_parenthesized_expression = true;
- preferences.insert_space_before_closing_paren_in_parenthesized_expression = true;
- preferences.insert_space_before_parenthesized_expression_in_throw = true;
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test630", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=158267
- public void _test631() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_THROW, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test631", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=158267
- public void _test632() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_THROW, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test632", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=165210
- public void _test633() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS, "3");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test633", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=165210
- public void _test634() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS, "1");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test634", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=165210
- public void _test635() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS, "1");
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_IMPORTS, "0");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test635", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=165210
- public void _test636() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS, "3");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test636", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=165210
- public void _test637() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS, "2");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test637", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=165210
- public void _test638() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS, "1");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test638", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=165210
- public void _test639() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS, "2");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test639", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=165210
- public void _test640() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS, "1");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test640", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=168109
- public void _test641() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, DefaultCodeFormatterConstants.MIXED);
- options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "36");
- options.put(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE, "2");
- options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test641", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=166962
- public void _test642() {
- String resourcePath = getResource("test642", "formatter.xml");
- Map options = DecodeCodeFormatterPreferences.decodeCodeFormatterOptions(resourcePath, "Visionnaire");
- assertNotNull("No preferences", options);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test642", "A.js", CodeFormatter.K_JAVASCRIPT_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171634
- public void _test643() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test643", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171634
- public void _test644() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test644", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171634
- public void _test645() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, JavaScriptCore.INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test645", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171634
- public void _test646() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test646", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171634
- public void _test647() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, JavaScriptCore.DO_NOT_INSERT);
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test647", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171634
- public void _test648() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, JavaScriptCore.DO_NOT_INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "0");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test648", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171634
- public void _test649() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, JavaScriptCore.INSERT);
- options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "0");
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test649", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=172848
- public void _test650() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test650", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=172848
- public void _test651() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test651", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=172848
- public void _test652() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test652", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=172848
- public void _test653() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test653", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=172848
- public void _test654() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test654", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=172848
- public void _test655() {
- final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
- DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
- runTest(codeFormatter, "test655", "A.js");//$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentFormatterUtil.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentFormatterUtil.java
deleted file mode 100644
index 7b6407b..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentFormatterUtil.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.formatter.comment;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.TextEdit;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TextUtilities;
-
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.ToolFactory;
-import org.eclipse.wst.jsdt.core.formatter.CodeFormatter;
-import org.eclipse.wst.jsdt.core.formatter.DefaultCodeFormatterConstants;
-
-/**
- * Utilities for the comment formatter.
- *
- * @since 3.0
- */
-public class CommentFormatterUtil {
- /**
- * Formats the source string as a comment region of the specified kind.
- *
- * Both offset and length must denote a valid comment partition, that is
- * to say a substring that starts and ends with the corresponding
- * comment delimiter tokens.
- *
- * @param kind the kind of the comment
- * @param source the source string to format
- * @param offset the offset relative to the source string where to
- * format
- * @param length the length of the region in the source string to format
- * @param preferences preferences for the comment formatter
- * @return the formatted source string
- */
- public static String format(int kind, String source, int offset, int length, Map preferences) {
- Assert.isNotNull(source);
- IDocument document= new Document(source);
-
- try {
- int indentOffset= document.getLineOffset(document.getLineOfOffset(offset));
- int indentationLevel= inferIndentationLevel(document.get(indentOffset, offset - indentOffset), getTabSize(preferences));
- return format(kind, source, offset, length, indentationLevel, preferences);
- } catch (BadLocationException x) {
- throw new RuntimeException(x);
- }
- }
-
- /**
- * Formats the source string as a comment region of the specified kind.
- *
- * Both offset and length must denote a valid comment partition, that is
- * to say a substring that starts and ends with the corresponding
- * comment delimiter tokens.
- *
- * @param kind the kind of the comment
- * @param source the source string to format
- * @param offset the offset relative to the source string where to
- * format
- * @param length the length of the region in the source string to format
- * @param preferences preferences for the comment formatter
- * @return the formatted source string
- */
- public static String format(int kind, String source, int offset, int length, int indentationLevel, Map preferences) {
- Assert.isTrue(kind == CodeFormatter.K_JAVA_DOC || kind == CodeFormatter.K_MULTI_LINE_COMMENT || kind == CodeFormatter.K_SINGLE_LINE_COMMENT);
-
- Assert.isNotNull(source);
- Assert.isNotNull(preferences);
-
- Assert.isTrue(offset >= 0);
- Assert.isTrue(length <= source.length());
-
- IDocument document= new Document(source);
-
- TextEdit edit;
- edit= ToolFactory.createCodeFormatter(preferences).format(kind, source, offset, length, indentationLevel, TextUtilities.getDefaultLineDelimiter(document));
-
- try {
- if (edit != null)
- edit.apply(document);
- } catch (MalformedTreeException x) {
- throw new RuntimeException(x);
- } catch (BadLocationException x) {
- throw new RuntimeException(x);
- }
- return document.get();
- }
-
- /**
- * Infer the indentation level based on the given reference indentation,
- * tab size and text measurement.
- *
- * @param reference the reference indentation
- * @param tabSize the tab size
- * @return the inferred indentation level
- * @since 3.1
- */
- private static int inferIndentationLevel(String reference, int tabSize) {
- StringBuffer expanded= expandTabs(reference, tabSize);
-
- int spaceWidth, referenceWidth;
- spaceWidth= 1;
- referenceWidth= expanded.length();
-
- int level= referenceWidth / (tabSize * spaceWidth);
- if (referenceWidth % (tabSize * spaceWidth) > 0)
- level++;
- return level;
- }
-
- /**
- * Expands the given string's tabs according to the given tab size.
- *
- * @param string the string
- * @param tabSize the tab size
- * @return the expanded string
- * @since 3.1
- */
- private static StringBuffer expandTabs(String string, int tabSize) {
- StringBuffer expanded= new StringBuffer();
- for (int i= 0, n= string.length(), chars= 0; i < n; i++) {
- char ch= string.charAt(i);
- if (ch == '\t') {
- for (; chars < tabSize; chars++)
- expanded.append(' ');
- chars= 0;
- } else {
- expanded.append(ch);
- chars++;
- if (chars >= tabSize)
- chars= 0;
- }
-
- }
- return expanded;
- }
-
- /**
- * Returns the value of {@link DefaultCodeFormatterConstants#FORMATTER_TAB_SIZE}
- * from the given preferences.
- *
- * @param preferences the preferences
- * @return the value of {@link DefaultCodeFormatterConstants#FORMATTER_TAB_SIZE}
- * from the given preferences
- * @since 3.1
- */
- private static int getTabSize(Map preferences) {
- if (preferences.containsKey(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE))
- try {
- return Integer.parseInt((String) preferences.get(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE));
- } catch (NumberFormatException e) {
- // use default
- }
- return 4;
- }
-
- /**
- * Creates a formatting options with all default options and the given custom user options.
- *
- * @param user the custom user options
- * @return the formatting options
- * @since 3.1
- */
- public static Map createOptions(Map user) {
- final Map map= JavaScriptCore.getOptions();
-
- if (user != null) {
-
- for (final Iterator iterator= user.keySet().iterator(); iterator.hasNext();) {
-
- Object key= iterator.next();
- Object value = user.get(key);
- map.put(key, value);
- }
- }
- return map;
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentTestCase.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentTestCase.java
deleted file mode 100644
index 453cc16..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentTestCase.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.formatter.comment;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextUtilities;
-
-import org.eclipse.wst.jsdt.core.formatter.CodeFormatter;
-import org.eclipse.wst.jsdt.core.tests.model.SuiteOfTestCases;
-
-public abstract class CommentTestCase extends SuiteOfTestCases {
- public static Test buildTestSuite(Class evaluationTestClass) {
- return buildTestSuite(evaluationTestClass, null); //$NON-NLS-1$
- }
-
- public static Test buildTestSuite(Class evaluationTestClass, String suiteName) {
- TestSuite suite = new Suite(suiteName==null?evaluationTestClass.getName():suiteName);
- List tests = buildTestsList(evaluationTestClass);
- for (int index=0, size=tests.size(); index= 0);
- assertTrue(offset < text.length());
- assertTrue(length >= 0);
- assertTrue(offset + length <= text.length());
-
- assertTrue(kind == CodeFormatter.K_JAVA_DOC || kind == CodeFormatter.K_MULTI_LINE_COMMENT || kind == CodeFormatter.K_SINGLE_LINE_COMMENT);
-
- return CommentFormatterUtil.format(kind, text, offset, length, CommentFormatterUtil.createOptions(options));
- }
- protected String testFormat(String text, int offset, int length, int kind, int indentationLevel) {
- assertNotNull(text);
- assertTrue(offset >= 0);
- assertTrue(offset < text.length());
- assertTrue(length >= 0);
- assertTrue(offset + length <= text.length());
-
- assertTrue(kind == CodeFormatter.K_JAVA_DOC || kind == CodeFormatter.K_MULTI_LINE_COMMENT || kind == CodeFormatter.K_SINGLE_LINE_COMMENT);
-
- return CommentFormatterUtil.format(kind, text, offset, length, indentationLevel, CommentFormatterUtil.createOptions(getUserOptions()));
- }
-
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentsTestSuite.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentsTestSuite.java
deleted file mode 100644
index 2b3c196..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentsTestSuite.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.formatter.comment;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * @since 3.0
- */
-public class CommentsTestSuite extends TestSuite {
-
- public static Test suite() {
- return new CommentsTestSuite();
- }
-
- public CommentsTestSuite() {
- addTest(MultiLineTestCase.suite());
- addTest(SingleLineTestCase.suite());
- //addTest(JavaDocTestCase.suite());
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/JavaDocTestCase.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/JavaDocTestCase.java
deleted file mode 100644
index e50b9d5..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/JavaDocTestCase.java
+++ /dev/null
@@ -1,703 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.formatter.comment;
-
-import java.util.Map;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.formatter.CodeFormatter;
-import org.eclipse.wst.jsdt.core.formatter.DefaultCodeFormatterConstants;
-
-import org.eclipse.wst.jsdt.internal.formatter.comment.JavaDocLine;
-import org.eclipse.wst.jsdt.internal.formatter.comment.MultiCommentLine;
-
-public class JavaDocTestCase extends CommentTestCase {
-
- static {
-// TESTS_NAMES = new String[] { "test75460" } ;
- }
-
- protected static final String INFIX= MultiCommentLine.MULTI_COMMENT_CONTENT_PREFIX;
-
- protected static final String POSTFIX= MultiCommentLine.MULTI_COMMENT_END_PREFIX;
-
- protected static final String PREFIX= JavaDocLine.JAVADOC_START_PREFIX;
-
- public static Test suite() {
- return buildTestSuite(JavaDocTestCase.class);
- }
-
- public JavaDocTestCase(String name) {
- super(name);
- }
-
- protected int getCommentKind() {
- return CodeFormatter.K_JAVA_DOC;
- }
-
- public void testSingleLineComment1() {
- assertEquals(PREFIX + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX, testFormat(PREFIX + "\t\t" + DELIMITER + "*\t test*/")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testSingleLineComment2() {
- assertEquals(PREFIX + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX, testFormat(PREFIX + "test" + DELIMITER + "\t" + POSTFIX)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testSingleLineComment3() {
- assertEquals(PREFIX + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX, testFormat(PREFIX + DELIMITER + "* test\t*/")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineComment4() {
- assertEquals(PREFIX + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX, testFormat(PREFIX + "test" + DELIMITER + POSTFIX)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentSpace1() {
- assertEquals(PREFIX + " test" + POSTFIX, testFormat(PREFIX + "test*/")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentSpace2() {
- assertEquals(PREFIX + " test" + POSTFIX, testFormat(PREFIX + "test" + POSTFIX)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentSpace3() {
- assertEquals(PREFIX + " test" + POSTFIX, testFormat(PREFIX + "test*/")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentSpace4() {
- assertEquals(PREFIX + " test test" + POSTFIX, testFormat(PREFIX + " test test*/")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentTabs1() {
- assertEquals(PREFIX + " test test" + POSTFIX, testFormat(PREFIX + "\ttest\ttest" + POSTFIX)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentTabs2() {
- assertEquals(PREFIX + " test test" + POSTFIX, testFormat(PREFIX + "\ttest\ttest*/")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testMultiLineCommentBreak1() {
- String input= PREFIX + " test test" + POSTFIX; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + INFIX + "test " + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(expected, testFormat(input));
- }
-
- public void testMultiLineCommentCodeSnippet1() {
- String prefix= PREFIX + DELIMITER + INFIX + "" + DELIMITER + INFIX; //$NON-NLS-1$
- String postfix= DELIMITER + INFIX + " " + DELIMITER + POSTFIX; //$NON-NLS-1$
- String input= prefix + "while (i != 0) i--;" + postfix; //$NON-NLS-1$
- String expected= prefix + "while (i != 0)" + DELIMITER + INFIX + "\ti--;" + postfix; //$NON-NLS-1$//$NON-NLS-2$
- String result= testFormat(input);
- assertEquals(expected, result);
-
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
-
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Error in formatting parts of java code snippets in comment
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44035
- */
- public void testMultiLineCommentCodeSnippet2() {
- String prefix= PREFIX + DELIMITER + INFIX + "" + DELIMITER + INFIX; //$NON-NLS-1$
- String postfix= DELIMITER + INFIX + " " + DELIMITER + POSTFIX; //$NON-NLS-1$
- String input= prefix + "while (i != 0) { i--; }" + postfix; //$NON-NLS-1$
- String expected= prefix + "while (i != 0) {" + DELIMITER + INFIX + "\ti--;" + DELIMITER + INFIX + "}" + postfix; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String result= testFormat(input);
- assertEquals(expected, result);
-
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
-
- assertEquals(expected, result);
- }
-
- public void testMultiLineCommentCodeSnippet3() {
- String input= PREFIX + DELIMITER + "" + DELIMITER + "while (i != 0)" + DELIMITER + "i--;" + DELIMITER + " " + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- String expected= PREFIX + DELIMITER + INFIX + "" + DELIMITER + INFIX + "while (i != 0)" + DELIMITER + INFIX + "\ti--;" + DELIMITER + INFIX + " " + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- String result= testFormat(input);
- assertEquals(expected, result);
-
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
-
- assertEquals(expected, result);
- }
-
- public void testMultiLineCommentCodeSnippetHtmlEntities1() {
- String prefix= PREFIX + DELIMITER + INFIX + "" + DELIMITER + INFIX; //$NON-NLS-1$
- String postfix= DELIMITER + INFIX + " " + DELIMITER + POSTFIX; //$NON-NLS-1$
- String input= prefix + "System.out.println(\"test\");" + postfix; //$NON-NLS-1$
- String expected= prefix + "System.out.println("test");" + postfix; //$NON-NLS-1$
- String result= testFormat(input);
- assertEquals(expected, result);
-
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
-
- assertEquals(expected, result);
- }
-
- public void testMultiLineCommentIndentTabs1() {
- String prefix= "public class Test {" + DELIMITER + "\t\t"; //$NON-NLS-1$ //$NON-NLS-2$
- String content= PREFIX + DELIMITER + "\t\t\t" + INFIX + "test test" + DELIMITER + "\t\t\t\t" + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- String postfix= DELIMITER + "}"; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + "\t\t" + INFIX + "test test" + DELIMITER + "\t\t" + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- assertEquals(prefix + expected + postfix, testFormat(prefix + content + postfix, prefix.length(), content.length()));
- }
-
- /**
- * [formatting] Comments formatter inserts tabs when it should use spaces
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=47491
- */
- public void testMultiLineCommentIndentSpaces1() {
- String prefix= "public class Test {" + DELIMITER + "\t"; //$NON-NLS-1$ //$NON-NLS-2$
- String content= PREFIX + DELIMITER + "\t\t" + INFIX + "test test" + DELIMITER + " " + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- String postfix= DELIMITER + "}"; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + " " + INFIX + "test test" + DELIMITER + " " + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.SPACE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "3"); //$NON-NLS-1$
- assertEquals(prefix + expected + postfix, testFormat(prefix + content + postfix, prefix.length(), content.length()));
- }
-
- public void testMultiLineCommentIndentSpaces2() {
- String prefix= "public class Test {" + DELIMITER + " "; //$NON-NLS-1$ //$NON-NLS-2$
- String content= PREFIX + DELIMITER + "\t\t" + INFIX + "test test" + DELIMITER + " " + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- String postfix= DELIMITER + "}"; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + " " + INFIX + "test test" + DELIMITER + " " + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.SPACE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "3"); //$NON-NLS-1$
- assertEquals(prefix + expected + postfix, testFormat(prefix + content + postfix, prefix.length(), content.length()));
- }
-
- public void testMultiLineCommentIndentSpaces3() {
- String prefix= "public class Test {" + DELIMITER + " \t "; //$NON-NLS-1$ //$NON-NLS-2$
- String content= PREFIX + DELIMITER + "\t\t" + INFIX + "test test" + DELIMITER + " " + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- String postfix= DELIMITER + "}"; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + " " + INFIX + "test test" + DELIMITER + " " + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.SPACE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "3"); //$NON-NLS-1$
- assertEquals(prefix + expected + postfix, testFormat(prefix + content + postfix, prefix.length(), content.length()));
- }
-
- public void testMultiLineCommentIndentSpaces4() {
- String prefix= "public class Test {" + DELIMITER + " \t "; //$NON-NLS-1$ //$NON-NLS-2$
- String content= PREFIX + DELIMITER + "\t\t" + INFIX + "test test" + DELIMITER + " " + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- String postfix= DELIMITER + "}"; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + " " + INFIX + "test test" + DELIMITER + " " + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.SPACE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "3"); //$NON-NLS-1$
- assertEquals(prefix + expected + postfix, testFormat(prefix + content + postfix, prefix.length(), content.length()));
- }
-
- /**
- * [formatting] Repeated insertion of new line when formatting javadoc comment
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=50212
- */
- public void testMultiLineCommentBlankLineAfterPre1() {
- String input= PREFIX + DELIMITER + INFIX + " " + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$
- String expected= PREFIX + DELIMITER + INFIX + " " + DELIMITER + INFIX + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$
- String result= testFormat(input);
- assertEquals(expected, result);
- result= testFormat(result);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting][implementation] comment line length not correctly applied
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46341
- * Do not wrap.
- */
- public void testMultiLineCommentLineBreakBeforeImmutableRegions1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "22"); //$NON-NLS-1$
- String input= PREFIX + DELIMITER + INFIX + "a test
" + DELIMITER + POSTFIX; //$NON-NLS-1$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting][implementation] comment line length not correctly applied
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46341
- * Do wrap.
- */
- public void testMultiLineCommentLineBreakBeforeImmutableRegions2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "21"); //$NON-NLS-1$
- String input= PREFIX + DELIMITER + INFIX + "a test
" + DELIMITER + POSTFIX; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + INFIX + "a" + DELIMITER + INFIX + "test
" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting][implementation] comment line length not correctly applied
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46341
- * Do not wrap. (Consecutive immutable regions on multiple lines.)
- */
- public void testMultiLineCommentLineBreakBeforeImmutableRegions3() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "20"); //$NON-NLS-1$
- String input= PREFIX + DELIMITER + INFIX + "a " + DELIMITER + INFIX + "testestestestestestestestestest" + DELIMITER + INFIX + "
" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * Prefs > Java > Code Formatter > Comments: Preview incorrect
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55204
- * Do not insert blank line before Javadoc tags
- */
- public void testMultiLineCommentBlankLineBeforeJavadoctags1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS, JavaScriptCore.DO_NOT_INSERT); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE); //$NON-NLS-1$
- String input= PREFIX + DELIMITER + INFIX + "Description" + DELIMITER + INFIX + "@param test" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * Prefs > Java > Code Formatter > Comments: Preview incorrect
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55204
- * Do insert blank line before Javadoc tags
- */
- public void testMultiLineCommentBlankLineBeforeJavadoctags2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS, JavaScriptCore.INSERT); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.TRUE); //$NON-NLS-1$
- String prefix= PREFIX + DELIMITER + INFIX + "Description"; //$NON-NLS-1$
- String postfix= DELIMITER + INFIX + "@param test" + DELIMITER + POSTFIX; //$NON-NLS-1$
- String input= prefix + postfix;
- String expected= prefix + DELIMITER + INFIX + postfix;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * Prefs > Java > Code Formatter > Comments: Preview incorrect
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55204
- * Do not remove blank line before Javadoc tags
- */
- public void testMultiLineCommentBlankLineBeforeJavadoctags3() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS, JavaScriptCore.INSERT); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.TRUE); //$NON-NLS-1$
- String input= PREFIX + DELIMITER + INFIX + "Description" + DELIMITER + INFIX + DELIMITER + INFIX + "@param test" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * Prefs > Java > Code Formatter > Comments: Preview incorrect
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55204
- * Do remove blank line before Javadoc tags
- */
- public void testMultiLineCommentBlankLineBeforeJavadoctags4() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS, JavaScriptCore.DO_NOT_INSERT); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT,DefaultCodeFormatterConstants.TRUE); //$NON-NLS-1$
- String prefix= PREFIX + DELIMITER + INFIX + "Description"; //$NON-NLS-1$
- String postfix= DELIMITER + INFIX + "@param test" + DELIMITER + POSTFIX; //$NON-NLS-1$
- String input= prefix + DELIMITER + INFIX + postfix;
- String expected= prefix + postfix;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * Prefs > Java > Code Formatter > Comments: Preview incorrect
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55204
- * Do not insert blank line before Javadoc tags
- * @deprecated
- */
- public void testMultiLineCommentBlankLineBeforeJavadoctags5() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS, JavaScriptCore.DO_NOT_INSERT); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES, DefaultCodeFormatterConstants.FALSE); //$NON-NLS-1$
- String input= PREFIX + DELIMITER + INFIX + "Description" + DELIMITER + INFIX + "@param test" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * Prefs > Java > Code Formatter > Comments: Preview incorrect
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55204
- * Do insert blank line before Javadoc tags
- * @deprecated
- */
- public void testMultiLineCommentBlankLineBeforeJavadoctags6() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS, JavaScriptCore.INSERT); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES, DefaultCodeFormatterConstants.TRUE); //$NON-NLS-1$
- String prefix= PREFIX + DELIMITER + INFIX + "Description"; //$NON-NLS-1$
- String postfix= DELIMITER + INFIX + "@param test" + DELIMITER + POSTFIX; //$NON-NLS-1$
- String input= prefix + postfix;
- String expected= prefix + DELIMITER + INFIX + postfix;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * Prefs > Java > Code Formatter > Comments: Preview incorrect
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55204
- * Do not remove blank line before Javadoc tags
- * @deprecated
- */
- public void testMultiLineCommentBlankLineBeforeJavadoctags7() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS, JavaScriptCore.INSERT); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES, DefaultCodeFormatterConstants.TRUE); //$NON-NLS-1$
- String input= PREFIX + DELIMITER + INFIX + "Description" + DELIMITER + INFIX + DELIMITER + INFIX + "@param test" + DELIMITER + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * Prefs > Java > Code Formatter > Comments: Preview incorrect
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55204
- * Do remove blank line before Javadoc tags
- * @deprecated
- */
- public void testMultiLineCommentBlankLineBeforeJavadoctags8() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS, JavaScriptCore.DO_NOT_INSERT); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES,DefaultCodeFormatterConstants.TRUE); //$NON-NLS-1$
- String prefix= PREFIX + DELIMITER + INFIX + "Description"; //$NON-NLS-1$
- String postfix= DELIMITER + INFIX + "@param test" + DELIMITER + POSTFIX; //$NON-NLS-1$
- String input= prefix + DELIMITER + INFIX + postfix;
- String expected= prefix + postfix;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] javadoc formatter removes blank lines between empty javadoc tags (xdoclet fails)
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=68577
- */
- public void testLineBreaksBetweenEmptyJavaDocTags1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE); //$NON-NLS-1$
- String input= PREFIX + DELIMITER + INFIX + "@custom1" + DELIMITER + INFIX + DELIMITER + INFIX + "@custom2" + DELIMITER + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] javadoc formatter removes blank lines between empty javadoc tags (xdoclet fails)
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=68577
- */
- public void testLineBreaksBetweenEmptyJavaDocTags2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE); //$NON-NLS-1$
- String input= PREFIX + DELIMITER + INFIX + "@custom1" + DELIMITER + INFIX + "@custom2" + DELIMITER + POSTFIX; //$NON-NLS-1$//$NON-NLS-2$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- public void testNoChange1() {
- String content= PREFIX + DELIMITER + POSTFIX;
- assertEquals(content, testFormat(content));
- }
-
- public void testNoFormat1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE);
- String content= PREFIX + DELIMITER + INFIX + "test" + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX;
- assertEquals(content, testFormat(content));
- }
-
- /**
- * @deprecated
- */
- public void testNoFormat2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT, DefaultCodeFormatterConstants.FALSE);
- String content= PREFIX + DELIMITER + INFIX + "test" + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX;
- assertEquals(content, testFormat(content));
- }
-
-
- /**
- * [formatting] Javadoc Formatter mishandles spaces in comments
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49686
- */
- public void testInlineTag1() {
- String input= PREFIX + DELIMITER + INFIX + "{@link Object} has many methods." + DELIMITER + POSTFIX; //$NON-NLS-1$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Javadoc Formatter mishandles spaces in comments
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49686
- */
- public void testInlineTag2() {
- String input= PREFIX + DELIMITER + INFIX + "{@link Object}s are cool." + DELIMITER + POSTFIX; //$NON-NLS-1$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Javadoc Formatter mishandles spaces in comments
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49686
- */
- public void testMultilineInlineTag1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "20"); //$NON-NLS-1$
- final String prefix= PREFIX + DELIMITER + INFIX + "{@link Object}";
- final String postfix= "has many methods." + DELIMITER + POSTFIX;
- String input= prefix + " " + postfix; //$NON-NLS-1$
- String expected= prefix + DELIMITER + INFIX + postfix;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Javadoc Formatter mishandles spaces in comments
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49686
- */
- public void testMultilineInlineTag2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "20"); //$NON-NLS-1$
- final String prefix= PREFIX + DELIMITER + INFIX + "{@link Objecterr}s";
- final String postfix= "are cool." + DELIMITER + POSTFIX;
- String input= prefix + " " + postfix; //$NON-NLS-1$
- String expected= prefix + DELIMITER + INFIX + postfix;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Javadoc Formatter mishandles spaces in comments
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49686
- */
- public void testTagWordbreaks1() {
- String input= PREFIX + DELIMITER + INFIX + "Object
rocks." + DELIMITER + POSTFIX; //$NON-NLS-1$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Javadoc Formatter mishandles spaces in comments
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49686
- */
- public void testTagWordbreaks2() {
- String input= PREFIX + DELIMITER + INFIX + "Object
s are cool." + DELIMITER + POSTFIX; //$NON-NLS-1$
- String expected= input;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Javadoc Formatter mishandles spaces in comments
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49686
- */
- public void testMultilineTagWordbreaks1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "20"); //$NON-NLS-1$
- String prefix= PREFIX + DELIMITER + INFIX + "Object
";
- String postfix= "rocks." + DELIMITER + POSTFIX; //$NON-NLS-1$
- String input= prefix + " " + postfix;
- String expected= prefix + DELIMITER + INFIX + postfix;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Javadoc Formatter mishandles spaces in comments
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=49686
- */
- public void testMultilineTagWordbreaks2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "20"); //$NON-NLS-1$
- final String prefix= PREFIX + DELIMITER + INFIX + "Foo";
- final String postfix= "Obj
s" + DELIMITER + POSTFIX;
- String input= prefix + " " + postfix;
- String expected= prefix + DELIMITER + INFIX + postfix;
- String result= testFormat(input);
- assertEquals(expected, result);
- }
-
- public void testMultiLineComment() {
- String input= PREFIX + DELIMITER + " TOTO " + POSTFIX; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + INFIX + "TOTO" + DELIMITER + POSTFIX; //$NON-NLS-1$
- final String result = testFormat(input);
- assertEquals(expected, result);
- }
-
- public void testMultiLineComment2() {
- String input= PREFIX + DELIMITER + "TOTO" + POSTFIX; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + INFIX + "TOTO" + DELIMITER + POSTFIX; //$NON-NLS-1$
- final String result = testFormat(input);
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Javadoc formatting: extra newline with [pre]
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52921
- *
- * This test only formats once.
- *
- */
- public void testNoExtraNewlineWithPre1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, DefaultCodeFormatterConstants.TRUE);
- String input= PREFIX + DELIMITER + INFIX + "wrap here " + DELIMITER + POSTFIX; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + INFIX + "" + DELIMITER + INFIX + "wrap here" + DELIMITER + INFIX + " " + DELIMITER + POSTFIX; //$NON-NLS-1$; //$NON-NLS-2$; //$NON-NLS-3$;
- String result= testFormat(input);
- assertEquals(expected, result);
-
- // now re-format several times
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
-
- expected= PREFIX + DELIMITER + INFIX + "" + DELIMITER + INFIX + "wrap here" + DELIMITER + INFIX + " " + DELIMITER + POSTFIX; //$NON-NLS-1$; //$NON-NLS-2$; //$NON-NLS-3$;
- assertEquals(expected, result);
- }
-
- /**
- * [formatting] Javadoc formatting: extra newline with [pre]
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52921
- *
- * This test only formats once.
- *
- */
- public void testNoExtraNewlineWithPre2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, DefaultCodeFormatterConstants.FALSE);
- String input= PREFIX + DELIMITER + INFIX + "wrap here " + DELIMITER + POSTFIX; //$NON-NLS-1$
- String expected= PREFIX + DELIMITER + INFIX + "wrap here " + DELIMITER + POSTFIX; //$NON-NLS-1$
- String result= testFormat(input);
- assertEquals(expected, result);
-
- // now re-format several times
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
- result= testFormat(result);
-
- expected= PREFIX + DELIMITER + INFIX + "wrap here " + DELIMITER + POSTFIX; //$NON-NLS-1$
- assertEquals(expected, result);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=109605
- public void test109605() {
- String input = "/**" + DELIMITER +
- " * " + DELIMITER +
- " * " + DELIMITER +
- " * " + DELIMITER +
- " * " + DELIMITER +
- " * " + DELIMITER +
- " * @author Darren Pearce" + DELIMITER +
- " * @version 22-Sep-2005" + DELIMITER +
- " * " + DELIMITER +
- " */";
-
- String expected = "/**" + DELIMITER +
- " * " + DELIMITER +
- " * " + DELIMITER +
- " * " + DELIMITER +
- " * " + DELIMITER +
- " * @author Darren Pearce" + DELIMITER +
- " * @version 22-Sep-2005" + DELIMITER +
- " * " + DELIMITER +
- " */";
- String result=testFormat(input);
- assertEquals(expected, result);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=60453
- public void test60453() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "80");
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE);
-
- String input = "/** Creates a new instance of DynamicEventChannel sdf sdfs dsdf dsfsd fd fsd fsdf sdf dsfsd (on the same line)" + DELIMITER +
- "* @pre obj != null" + DELIMITER +
- "*/";
-
- String expected = "/**" + DELIMITER +
- " * Creates a new instance of DynamicEventChannel sdf sdfs dsdf dsfsd fd fsd fsdf" + DELIMITER +
- " * sdf dsfsd (on the same line)" + DELIMITER +
- " * " + DELIMITER +
- " * @pre obj != null" + DELIMITER +
- " */";
- String result=testFormat(input, options);
- assertEquals(expected, result);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60453
- * @deprecated
- */
- public void test60453_2() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "80");
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES, DefaultCodeFormatterConstants.FALSE);
-
- String input = "/** Creates a new instance of DynamicEventChannel sdf sdfs dsdf dsfsd fd fsd fsdf sdf dsfsd (on the same line)" + DELIMITER +
- "* @pre obj != null" + DELIMITER +
- "*/";
-
- String expected = "/**" + DELIMITER +
- " * Creates a new instance of DynamicEventChannel sdf sdfs dsdf dsfsd fd fsd fsdf" + DELIMITER +
- " * sdf dsfsd (on the same line)" + DELIMITER +
- " * " + DELIMITER +
- " * @pre obj != null" + DELIMITER +
- " */";
- String result=testFormat(input, options);
- assertEquals(expected, result);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=75460
- public void test75460() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "200");
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE);
-
- String input = "/**" + DELIMITER +
- ""+ DELIMITER +
- " Object[] objects = new Object[3];" + DELIMITER +
- " objects[0] = new String(\"Hallo Welt !!!\");" + DELIMITER +
- " objects[1] = new String(\"Test !!!\");" + DELIMITER +
- " objects[2] = new Integer(\"1980\");" + DELIMITER +
- " ObjectFile.write(pathname, objects);" + DELIMITER +
- " Object[] objs = ObjectFile.read(pathname);" + DELIMITER +
- " for(int i = 0; i < objs.length; i++)" + DELIMITER +
- " {" + DELIMITER +
- " System.out.println(objs[i].toString());" + DELIMITER +
- " }" + DELIMITER +
- " "+ DELIMITER +
- "*/";
-
- String expected = "/**" + DELIMITER +
- " * " + DELIMITER +
- " * Object[] objects = new Object[3];" + DELIMITER +
- " * objects[0] = new String("Hallo Welt !!!");" + DELIMITER +
- " * objects[1] = new String("Test !!!");" + DELIMITER +
- " * objects[2] = new Integer("1980");" + DELIMITER +
- " * ObjectFile.write(pathname, objects);" + DELIMITER +
- " * Object[] objs = ObjectFile.read(pathname);" + DELIMITER +
- " * for (int i = 0; i < objs.length; i++) {" + DELIMITER +
- " * System.out.println(objs[i].toString());" + DELIMITER +
- " * }" + DELIMITER +
- " * " + DELIMITER +
- " */";
- String result=testFormat(input, options);
- assertEquals(expected, result);
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/MultiLineTestCase.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/MultiLineTestCase.java
deleted file mode 100644
index 0fbc781..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/MultiLineTestCase.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.formatter.comment;
-
-import java.util.Map;
-
-import org.eclipse.wst.jsdt.core.formatter.CodeFormatter;
-import org.eclipse.wst.jsdt.core.formatter.DefaultCodeFormatterConstants;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.internal.formatter.comment.MultiCommentLine;
-
-public class MultiLineTestCase extends CommentTestCase {
- protected static final String INFIX= MultiCommentLine.MULTI_COMMENT_CONTENT_PREFIX;
-
- protected static final String POSTFIX= MultiCommentLine.MULTI_COMMENT_END_PREFIX;
-
- protected static final String PREFIX= MultiCommentLine.MULTI_COMMENT_START_PREFIX;
-
- public static Test suite() {
- return buildTestSuite(MultiLineTestCase.class);
- }
-
- public MultiLineTestCase(String name) {
- super(name);
- }
-
- protected int getCommentKind() {
- return CodeFormatter.K_MULTI_LINE_COMMENT;
- }
-
- public void testSingleLineComment1() {
- assertEquals("/*" + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX, testFormat("/*\t\t" + DELIMITER + "*\t test*/")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- public void testSingleLineComment2() {
- assertEquals("/*" + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX, testFormat(PREFIX + "test" + DELIMITER + "\t" + POSTFIX)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- public void testSingleLineComment3() {
- assertEquals("/*" + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX, testFormat(PREFIX + DELIMITER + "* test\t*/")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testSingleLineComment4() {
- assertEquals("/*" + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX, testFormat("/*test" + DELIMITER + POSTFIX)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testSingleLineCommentSpace1() {
- assertEquals(PREFIX + "test" + POSTFIX, testFormat("/*test*/")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentSpace2() {
- assertEquals(PREFIX + "test" + POSTFIX, testFormat("/*test" + POSTFIX)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentSpace3() {
- assertEquals(PREFIX + "test" + POSTFIX, testFormat(PREFIX + "test*/")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentSpace4() {
- assertEquals(PREFIX + "test test" + POSTFIX, testFormat("/* test test*/")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentTabs1() {
- assertEquals(PREFIX + "test test" + POSTFIX, testFormat("/*\ttest\ttest" + POSTFIX)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testSingleLineCommentTabs2() {
- assertEquals(PREFIX + "test test" + POSTFIX, testFormat("/*\ttest\ttest*/")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * [formatting] formatter removes last line with block comments
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51654
- */
- public void testMultiLineCommentAsterisk1() {
- // test3 (currently) forces the comment formatter to actually do something, it wouldn't do anything otherwise.
- String input= PREFIX + INFIX + "test1" + DELIMITER + "test2" + INFIX + DELIMITER + "test3" + DELIMITER + "test4" + POSTFIX; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- String result= testFormat(input);
- assertTrue(result.indexOf("test1") != -1); //$NON-NLS-1$
- assertTrue(result.indexOf("test2") != -1); //$NON-NLS-1$
- assertTrue(result.indexOf("test3") != -1); //$NON-NLS-1$
- assertTrue(result.indexOf("test4") != -1); //$NON-NLS-1$
- }
-
- public void testNoChange1() {
- String content= PREFIX + DELIMITER + POSTFIX;
- assertEquals(content, testFormat(content));
- }
-
- public void testNoFormat1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
- String content= PREFIX + DELIMITER + INFIX + "test" + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX;
- assertEquals(content, testFormat(content));
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=145544
- */
- public void testMultiLineCommentFor145544() {
- setUserOption(DefaultCodeFormatterConstants.getJavaConventionsSettings());
- String input= "/**\n" + //$NON-NLS-1$
- " * Member comment\n" +//$NON-NLS-1$
- " */";//$NON-NLS-1$
- String result= testFormat(input, 0, input.length(), CodeFormatter.K_MULTI_LINE_COMMENT , 2);
- String expectedOutput = "/***********************************************************************\n" +
- " * Member comment\n" +
- " */";
- assertEquals("Different output", expectedOutput, result);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=75460
- public void test75460() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "200");
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
-
- String input = "/*" + DELIMITER +
- " var objects = new Array(3);" + DELIMITER +
- " objects[0] = new String(\"Hallo Welt !!!\");" + DELIMITER +
- " objects[1] = new String(\"Test !!!\");" + DELIMITER +
- " objects[2] = new Number(\"1980\");" + DELIMITER +
- " var objs = ObjectFile.read(pathname);" + DELIMITER +
- " for(int i = 0; i < objs.length; i++)" + DELIMITER +
- " {" + DELIMITER +
- " alert(objs[i].toString());" + DELIMITER +
- " }" + DELIMITER +
- "*/";
-
- String expected = input;
- String result=testFormat(input, options);
- assertEquals(expected, result);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49412
- // check backward compatibility
- public void test49412() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "200");
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.TRUE);
-
- String input = "/*" + DELIMITER + DELIMITER +
- " test block comment with a blank line" + DELIMITER +
- "*/";
-
- String expected= "/*" + DELIMITER +
- " * test block comment with a blank line" + DELIMITER +
- " */";
-
- String result=testFormat(input, options);
- assertEquals(expected, result);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49412
- // check backward compatibility
- public void test49412_2() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "200");
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.TRUE);
-
- String input = "/*" + DELIMITER + DELIMITER +
- " test block comment with a blank line" + DELIMITER +
- "*/";
-
- String expected= input;
-
- String result=testFormat(input, options);
- assertEquals(expected, result);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=49412
- // check backward compatibility
- public void test49412_3() {
- Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "200");
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT, DefaultCodeFormatterConstants.TRUE);
- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
-
- String input = "/*" + DELIMITER + DELIMITER +
- " test block comment with a blank line" + DELIMITER +
- "*/";
-
- String expected= "/*" + DELIMITER +
- " * "+ DELIMITER +
- " * test block comment with a blank line" + DELIMITER +
- " */";
-
- String result=testFormat(input, options);
- assertEquals(expected, result);
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/SingleLineTestCase.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/SingleLineTestCase.java
deleted file mode 100644
index 8130848..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/SingleLineTestCase.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.formatter.comment;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.formatter.CodeFormatter;
-import org.eclipse.wst.jsdt.core.formatter.DefaultCodeFormatterConstants;
-
-import org.eclipse.wst.jsdt.internal.formatter.comment.SingleCommentLine;
-
-public class SingleLineTestCase extends CommentTestCase {
- protected static final String PREFIX= SingleCommentLine.SINGLE_COMMENT_PREFIX;
-
- public static Test suite() {
- return buildTestSuite(SingleLineTestCase.class);
- }
-
- public SingleLineTestCase(String name) {
- super(name);
- }
-
- protected int getCommentKind() {
- return CodeFormatter.K_SINGLE_LINE_COMMENT;
- }
-
- public void testClearBlankLines1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE);
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest" + DELIMITER + "//" + DELIMITER + "//\t\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- }
-
- public void testClearBlankLines2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE);
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\t\ttest" + DELIMITER + PREFIX + DELIMITER + "//\t\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- }
-
- public void testClearBlankLines3() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE);
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest" + DELIMITER + "//" + DELIMITER + PREFIX + "test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- }
-
- public void testCommentBegin1() {
- assertEquals(PREFIX + "test" + DELIMITER, testFormat("//test")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCommentBegin2() {
- assertEquals(PREFIX + "test" + DELIMITER, testFormat(PREFIX + "test")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCommentBegin3() {
- assertEquals(PREFIX + "test" + DELIMITER, testFormat("//\t\ttest " + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCommentDelimiter1() {
- assertEquals(PREFIX + "test" + DELIMITER, testFormat("//\t\ttest " + DELIMITER + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCommentDelimiter2() {
- assertEquals(PREFIX + "test" + DELIMITER, testFormat(PREFIX + "test " + DELIMITER + DELIMITER + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCommentSpace1() {
- assertEquals(PREFIX + "test test" + DELIMITER, testFormat("//test\t \t test")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCommentSpace2() {
- assertEquals(PREFIX + "test test" + DELIMITER, testFormat("//test test")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCommentSpace3() {
- assertEquals(PREFIX + "test test" + DELIMITER, testFormat(PREFIX + "test \t \t test")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCommentWrapping1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testCommentWrapping2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "1"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testCommentWrapping3() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "32"); //$NON-NLS-1$
- assertEquals(PREFIX + "test test" + DELIMITER, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testCommentWrapping4() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "32"); //$NON-NLS-1$
- assertEquals(PREFIX + "test test" + DELIMITER, testFormat("//test\ttest" + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testCommentWrapping5() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaScriptCore.TAB);
- String prefix= "public class Test {" + DELIMITER + " int test; // test test test test test test test test test test test test";
- String inputInfix= " ";
- String expectedInfix= DELIMITER + "\t\t\t\t" + PREFIX;
- String suffix= "test" + DELIMITER + "}" + DELIMITER;
- String input= prefix + inputInfix + suffix;
- int offset= input.indexOf("//");
- assertEquals(prefix + expectedInfix + suffix, testFormat(input, offset, input.indexOf(DELIMITER, offset) + DELIMITER.length() - offset));
- }
-
- public void testHeaderComment1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER, DefaultCodeFormatterConstants.FALSE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "12"); //$NON-NLS-1$
- assertEquals(PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER, testFormat("//test\t\t\t\ttest" + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
-
- public void testHeaderComment2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER, DefaultCodeFormatterConstants.FALSE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "24"); //$NON-NLS-1$
- assertEquals(PREFIX + "test test test test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\t\t\t" + DELIMITER + PREFIX + "test test test test" + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- public void testIllegalLineLength1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "1"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testIllegalLineLength2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "-16"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat(PREFIX + "\t\t test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testMultipleComments1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test test" + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- }
-
- public void testMultipleComments2() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "12"); //$NON-NLS-1$
- assertEquals(PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test test\ttest" + DELIMITER + PREFIX + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- }
-
- public void testMultipleComments3() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "11"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("// test\t\t\ttest\ttest" + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
- }
-
- public void testIndentedComment1() {
- String prefix= "public class Test {" + DELIMITER + "\t";
- String comment= PREFIX + "test" + DELIMITER;
- String postfix= "}" + DELIMITER;
- String string= prefix + comment + postfix;
- assertEquals(string, testFormat(string, prefix.length(), comment.length()));
- }
-
- public void testIndentedComment2() {
- String prefix= "public class Test {" + DELIMITER + "\tpublic void test() {" + DELIMITER + "\t\t";
- String comment= PREFIX + "test" + DELIMITER;
- String postfix= "\t}" + DELIMITER + "}" + DELIMITER;
- String string= prefix + comment + postfix;
- assertEquals(string, testFormat(string, prefix.length(), comment.length()));
- }
-
- public void testIndentedComment3() {
- String prefix= "public class Test {" + DELIMITER + "\tpublic void test() {" + DELIMITER + "\t\tif (true) {" + DELIMITER + "\t\t\t";
- String comment= PREFIX + "test" + DELIMITER;
- String postfix= "\t\t}" + DELIMITER + "\t}" + DELIMITER + "}" + DELIMITER;
- String string= prefix + comment + postfix;
- assertEquals(string, testFormat(string, prefix.length(), comment.length()));
- }
-
- public void testNoChange1() {
- String content= PREFIX;
- assertEquals(content, testFormat(content));
- }
-
- public void testNoFormat1() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT, DefaultCodeFormatterConstants.FALSE);
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "1");
- String content= PREFIX + "test test";
- assertEquals(content, testFormat(content));
- }
- public void _test109581() {
- setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT, DefaultCodeFormatterConstants.TRUE);
- String content= "//// some comment ////";
- assertEquals(content + DELIMITER, testFormat(content));
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelCompletionTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelCompletionTests.java
deleted file mode 100644
index 15f8beb..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelCompletionTests.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.jsdt.core.*;
-import org.eclipse.wst.jsdt.internal.codeassist.RelevanceConstants;
-
-import junit.framework.*;
-
-public abstract class AbstractJavaModelCompletionTests extends AbstractJavaModelTests implements RelevanceConstants {
- public static List COMPLETION_SUITES = null;
- protected static IJavaScriptProject COMPLETION_PROJECT;
- protected class CompletionResult {
- public String proposals;
- public String context;
- public int cursorLocation;
- public int tokenStart;
- public int tokenEnd;
- }
- Hashtable oldOptions;
- IJavaScriptUnit wc = null;
-public AbstractJavaModelCompletionTests(String name) {
- super(name);
-}
-protected void addLibrary(String projectName, String jarName, String sourceZipName, String docZipName, boolean exported) throws JavaScriptModelException {
- IJavaScriptProject javaProject = getJavaProject(projectName);
- IProject project = javaProject.getProject();
- String projectPath = '/' + project.getName() + '/';
-
- IIncludePathAttribute[] extraAttributes;
- if(docZipName == null) {
- extraAttributes = new IIncludePathAttribute[0];
- } else {
- extraAttributes =
- new IIncludePathAttribute[]{
- JavaScriptCore.newIncludepathAttribute(
- IIncludePathAttribute.JSDOC_LOCATION_ATTRIBUTE_NAME,
- "jar:platform:/resource"+projectPath+docZipName+"!/")};
- }
-
- addLibraryEntry(
- javaProject,
- new Path(projectPath + jarName),
- sourceZipName == null ? null : new Path(projectPath + sourceZipName),
- sourceZipName == null ? null : new Path(""),
- null,
- null,
- extraAttributes,
- exported);
-}
-protected void removeLibrary(String projectName, String jarName) throws CoreException, IOException {
- IJavaScriptProject javaProject = getJavaProject(projectName);
- IProject project = javaProject.getProject();
- String projectPath = '/' + project.getName() + '/';
- removeLibraryEntry(javaProject, new Path(projectPath + jarName));
-}
-public IJavaScriptUnit getWorkingCopy(String path, String source) throws JavaScriptModelException {
- return super.getWorkingCopy(path, source, this.wcOwner, null);
-}
-protected CompletionResult complete(String path, String source, String completeBehind) throws JavaScriptModelException {
- return this.complete(path, source, false, completeBehind);
-}
-protected CompletionResult complete(String path, String source, boolean showPositions, String completeBehind) throws JavaScriptModelException {
- return this.complete(path,source,showPositions, completeBehind, null, null);
-}
-protected CompletionResult complete(String path, String source, boolean showPositions, String completeBehind, String tokenStartBehind, String token) throws JavaScriptModelException {
- this.wc = getWorkingCopy(path, source);
-
- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, showPositions);
- String str = this.wc.getSource();
- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
- int tokenStart = -1;
- int tokenEnd = -1;
- if(tokenStartBehind != null && token != null) {
- tokenStart = str.lastIndexOf(tokenStartBehind) + tokenStartBehind.length();
- tokenEnd = tokenStart + token.length() - 1;
- }
- this.wc.codeComplete(cursorLocation, requestor, this.wcOwner);
-
- CompletionResult result = new CompletionResult();
- result.proposals = requestor.getResults();
- result.context = requestor.getContext();
- result.cursorLocation = cursorLocation;
- result.tokenStart = tokenStart;
- result.tokenEnd = tokenEnd;
- return result;
-}
-protected CompletionResult contextComplete(IJavaScriptUnit cu, int cursorLocation) throws JavaScriptModelException {
- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, false);
- cu.codeComplete(cursorLocation, requestor, this.wcOwner);
-
- CompletionResult result = new CompletionResult();
- result.proposals = requestor.getResults();
- result.context = requestor.getContext();
- result.cursorLocation = cursorLocation;
- return result;
-}
-protected CompletionResult snippetContextComplete(
- IType type,
- String snippet,
- int insertion,
- int cursorLocation,
- boolean isStatic) throws JavaScriptModelException {
- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, false);
- type.codeComplete(snippet.toCharArray(), insertion, cursorLocation, null, null, null, isStatic, requestor, this.wcOwner);
-
- CompletionResult result = new CompletionResult();
- result.proposals = requestor.getResults();
- result.context = requestor.getContext();
- result.cursorLocation = cursorLocation;
- return result;
-}
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.oldOptions = JavaScriptCore.getOptions();
- waitUntilIndexesReady();
-}
-protected void setUp() throws Exception {
- super.setUp();
- this.wcOwner = new WorkingCopyOwner(){};
-}
-public void tearDownSuite() throws Exception {
- JavaScriptCore.setOptions(this.oldOptions);
- this.oldOptions = null;
- if (COMPLETION_SUITES == null) {
- deleteProject("Completion");
- } else {
- COMPLETION_SUITES.remove(getClass());
- if (COMPLETION_SUITES.size() == 0) {
- deleteProject("Completion");
- COMPLETION_SUITES = null;
- }
- }
- super.tearDownSuite();
-}
-protected void tearDown() throws Exception {
- if(this.wc != null) {
- this.wc.discardWorkingCopy();
- this.wc = null;
- }
- super.tearDown();
-}
-protected void assertResults(String expected, String actual) {
- try {
- assertEquals(expected, actual);
- } catch(ComparisonFailure c) {
- System.out.println(actual);
- System.out.println();
- throw c;
- }
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelTests.java
deleted file mode 100644
index ca77cbc..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelTests.java
+++ /dev/null
@@ -1,2261 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import java.io.*;
-import java.net.URL;
-import java.util.*;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.wst.jsdt.core.*;
-import org.eclipse.wst.jsdt.core.compiler.CharOperation;
-import org.eclipse.wst.jsdt.core.compiler.IProblem;
-import org.eclipse.wst.jsdt.core.compiler.libraries.SystemLibraryLocation;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.search.*;
-import org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase;
-import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.wst.jsdt.internal.core.ClasspathEntry;
-import org.eclipse.wst.jsdt.internal.core.JavaCorePreferenceInitializer;
-import org.eclipse.wst.jsdt.internal.core.JavaElement;
-import org.eclipse.wst.jsdt.internal.core.JavaModelManager;
-import org.eclipse.wst.jsdt.internal.core.NameLookup;
-import org.eclipse.wst.jsdt.internal.core.ResolvedSourceMethod;
-import org.eclipse.wst.jsdt.internal.core.ResolvedSourceType;
-import org.eclipse.wst.jsdt.internal.core.search.BasicSearchEngine;
-import org.eclipse.wst.jsdt.internal.core.util.Util;
-
-public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
-
- /**
- * The java.io.File path to the directory that contains the external jars.
- */
- protected static String EXTERNAL_JAR_DIR_PATH;
-
- // used java project
- protected IJavaScriptProject currentProject;
-
- // working copies usage
- protected IJavaScriptUnit[] workingCopies;
- protected WorkingCopyOwner wcOwner;
-
- // infos for invalid results
- protected int tabs = 2;
- protected boolean displayName = false;
- protected String endChar = ",";
-
- public static class ProblemRequestor implements IProblemRequestor {
- public StringBuffer problems;
- public int problemCount;
- protected char[] unitSource;
- public ProblemRequestor() {
- initialize(null);
- }
- public void acceptProblem(IProblem problem) {
- org.eclipse.wst.jsdt.core.tests.util.Util.appendProblem(this.problems, problem, this.unitSource, ++this.problemCount);
- this.problems.append("----------\n");
- }
- public void beginReporting() {
- this.problems.append("----------\n");
- }
- public void endReporting() {
- if (this.problemCount == 0)
- this.problems.append("----------\n");
- }
- public boolean isActive() {
- return true;
- }
- public void initialize(char[] source) {
- this.problems = new StringBuffer();
- this.problemCount = 0;
- this.unitSource = source;
- }
- }
-
- /**
- * Delta listener
- */
- protected class DeltaListener implements IElementChangedListener {
- /**
- * Deltas received from the java model. See
- * #startDeltas
and
- * #stopDeltas
.
- */
- public IJavaScriptElementDelta[] deltas;
-
- public ByteArrayOutputStream stackTraces;
-
- public void elementChanged(ElementChangedEvent ev) {
- IJavaScriptElementDelta[] copy= new IJavaScriptElementDelta[deltas.length + 1];
- System.arraycopy(deltas, 0, copy, 0, deltas.length);
- copy[deltas.length]= ev.getDelta();
- deltas= copy;
-
-// new Throwable("Caller of IElementChangedListener#elementChanged").printStackTrace(new PrintStream(this.stackTraces));
- }
- public JavaScriptUnit getCompilationUnitAST(IJavaScriptUnit workingCopy) {
- for (int i=0, length= this.deltas.length; i");
- }
- if (i != length-1)buffer.append("\n");
- }
- if (!expected.equals(buffer.toString())) {
- System.out.print(org.eclipse.wst.jsdt.core.tests.util.Util.displayString(buffer.toString(), 2));
- System.out.println(this.endChar);
- }
- assertEquals(
- message,
- expected,
- buffer.toString()
- );
- }
- protected void assertResourceNamesEqual(String message, String expected, Object[] resources) {
- sortResources(resources);
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = resources.length; i < length; i++) {
- if (resources[i] instanceof IResource) {
- buffer.append(((IResource)resources[i]).getName());
- } else if (resources[i] instanceof IStorage) {
- buffer.append(((IStorage) resources[i]).getName());
- } else if (resources[i] == null) {
- buffer.append("");
- }
- if (i != length-1)buffer.append("\n");
- }
- if (!expected.equals(buffer.toString())) {
- System.out.print(org.eclipse.wst.jsdt.core.tests.util.Util.displayString(buffer.toString(), 2));
- System.out.println(this.endChar);
- }
- assertEquals(
- message,
- expected,
- buffer.toString()
- );
- }
- protected void assertElementEquals(String message, String expected, IJavaScriptElement element) {
- String actual = element == null ? "" : ((JavaElement) element).toStringWithAncestors(false/*don't show key*/);
- if (!expected.equals(actual)) {
- if (this.displayName) System.out.println(getName()+" actual result is:");
- System.out.println(displayString(actual, this.tabs) + this.endChar);
- }
- assertEquals(message, expected, actual);
- }
- protected void assertElementsEqual(String message, String expected, IJavaScriptElement[] elements) {
- assertElementsEqual(message, expected, elements, false/*don't show key*/);
- }
- protected void assertElementsEqual(String message, String expected, IJavaScriptElement[] elements, boolean showResolvedInfo) {
- StringBuffer buffer = new StringBuffer();
- if (elements != null) {
- for (int i = 0, length = elements.length; i < length; i++){
- JavaElement element = (JavaElement)elements[i];
- if (element == null) {
- buffer.append("");
- } else {
- buffer.append(element.toStringWithAncestors(showResolvedInfo));
- }
- if (i != length-1) buffer.append("\n");
- }
- } else {
- buffer.append("");
- }
- String actual = buffer.toString();
- if (!expected.equals(actual)) {
- if (this.displayName) System.out.println(getName()+" actual result is:");
- System.out.println(displayString(actual, this.tabs) + this.endChar);
- }
- assertEquals(message, expected, actual);
- }
- protected void assertExceptionEquals(String message, String expected, JavaScriptModelException exception) {
- String actual = exception == null ? "" : exception.getStatus().getMessage();
- if (!expected.equals(actual)) {
- if (this.displayName) System.out.println(getName()+" actual result is:");
- System.out.println(displayString(actual, this.tabs) + this.endChar);
- }
- assertEquals(message, expected, actual);
- }
- protected void assertHierarchyEquals(String expected, ITypeHierarchy hierarchy) {
- String actual = hierarchy.toString();
- if (!expected.equals(actual)) {
- if (this.displayName) System.out.println(getName()+" actual result is:");
- System.out.println(displayString(actual, this.tabs) + this.endChar);
- }
- assertEquals("Unexpected type hierarchy", expected, actual);
- }
- protected void assertMarkers(String message, String expectedMarkers, IJavaScriptProject project) throws CoreException {
- waitForAutoBuild();
- IMarker[] markers = project.getProject().findMarkers(IJavaScriptModelMarker.BUILDPATH_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
- sortMarkers(markers);
- assertMarkers(message, expectedMarkers, markers);
- }
- protected void sortMarkers(IMarker[] markers) {
- org.eclipse.wst.jsdt.internal.core.util.Util.Comparer comparer = new org.eclipse.wst.jsdt.internal.core.util.Util.Comparer() {
- public int compare(Object a, Object b) {
- IMarker markerA = (IMarker)a;
- IMarker markerB = (IMarker)b;
- return markerA.getAttribute(IMarker.MESSAGE, "").compareTo(markerB.getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- };
- org.eclipse.wst.jsdt.internal.core.util.Util.sort(markers, comparer);
- }
- protected void assertMarkers(String message, String expectedMarkers, IMarker[] markers) throws CoreException {
- StringBuffer buffer = new StringBuffer();
- if (markers != null) {
- for (int i = 0, length = markers.length; i < length; i++) {
- IMarker marker = markers[i];
- buffer.append(marker.getAttribute(IMarker.MESSAGE));
- if (i != length-1) {
- buffer.append("\n");
- }
- }
- }
- String actual = buffer.toString();
- if (!expectedMarkers.equals(actual)) {
- System.out.println(org.eclipse.wst.jsdt.core.tests.util.Util.displayString(actual, 2));
- }
- assertEquals(message, expectedMarkers, actual);
- }
-
- protected void assertProblems(String message, String expected, ProblemRequestor problemRequestor) {
- String actual = org.eclipse.wst.jsdt.core.tests.util.Util.convertToIndependantLineDelimiter(problemRequestor.problems.toString());
- String independantExpectedString = org.eclipse.wst.jsdt.core.tests.util.Util.convertToIndependantLineDelimiter(expected);
- if (!independantExpectedString.equals(actual)){
- System.out.println(org.eclipse.wst.jsdt.core.tests.util.Util.displayString(actual, this.tabs));
- }
- assertEquals(
- message,
- independantExpectedString,
- actual);
- }
- /*
- * Asserts that the given actual source (usually coming from a file content) is equal to the expected one.
- * Note that 'expected' is assumed to have the '\n' line separator.
- * The line separators in 'actual' are converted to '\n' before the comparison.
- */
- protected void assertSourceEquals(String message, String expected, String actual) {
- if (actual == null) {
- assertEquals(message, expected, null);
- return;
- }
- actual = org.eclipse.wst.jsdt.core.tests.util.Util.convertToIndependantLineDelimiter(actual);
- if (!actual.equals(expected)) {
- System.out.print(org.eclipse.wst.jsdt.core.tests.util.Util.displayString(actual.toString(), 2));
- System.out.println(this.endChar);
- }
- assertEquals(message, expected, actual);
- }
- /*
- * Ensures that the toString() of the given AST node is as expected.
- */
- public void assertASTNodeEquals(String message, String expected, ASTNode actual) {
- String actualString = actual == null ? "null" : actual.toString();
- assertSourceEquals(message, expected, actualString);
- }
- /**
- * Ensures the elements are present after creation.
- */
- public void assertCreation(IJavaScriptElement[] newElements) {
- for (int i = 0; i < newElements.length; i++) {
- IJavaScriptElement newElement = newElements[i];
- assertTrue("Element should be present after creation", newElement.exists());
- }
- }
- protected void assertClasspathEquals(IIncludePathEntry[] classpath, String expected) {
- String actual;
- if (classpath == null) {
- actual = "";
- } else {
- StringBuffer buffer = new StringBuffer();
- int length = classpath.length;
- for (int i=0; i" : delta.toString();
- if (!expected.equals(actual)) {
- System.out.println(displayString(actual, 2));
- System.err.println(this.deltaListener.stackTraces.toString());
- }
- assertEquals(
- message,
- expected,
- actual);
- }
- protected void assertTypesEqual(String message, String expected, IType[] types) {
- assertTypesEqual(message, expected, types, true);
- }
- protected void assertTypesEqual(String message, String expected, IType[] types, boolean sort) {
- if (sort) this.sortTypes(types);
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < types.length; i++){
- if (types[i] == null)
- buffer.append("");
- else
- buffer.append(types[i].getFullyQualifiedName());
- buffer.append("\n");
- }
- String actual = buffer.toString();
- if (!expected.equals(actual)) {
- System.out.println(displayString(actual, 2) + this.endChar);
- }
- assertEquals(message, expected, actual);
- }
- protected void assertSortedStringsEqual(String message, String expected, String[] strings) {
- Util.sort(strings);
- assertStringsEqual(message, expected, strings);
- }
- protected void assertStringsEqual(String message, String expected, String[] strings) {
- String actual = toString(strings, true/*add extra new lines*/);
- if (!expected.equals(actual)) {
- System.out.println(displayString(actual, this.tabs) + this.endChar);
- }
- assertEquals(message, expected, actual);
- }
- protected void assertStringsEqual(String message, String[] expectedStrings, String[] actualStrings) {
- String expected = toString(expectedStrings, false/*don't add extra new lines*/);
- String actual = toString(actualStrings, false/*don't add extra new lines*/);
- if (!expected.equals(actual)) {
- System.out.println(displayString(actual, this.tabs) + this.endChar);
- }
- assertEquals(message, expected, actual);
- }
- /**
- * Attaches a source zip to the given jar package fragment root.
- */
- protected void attachSource(IPackageFragmentRoot root, String sourcePath, String sourceRoot) throws JavaScriptModelException {
- IJavaScriptProject javaProject = root.getJavaScriptProject();
- IIncludePathEntry[] entries = (IIncludePathEntry[])javaProject.getRawIncludepath().clone();
- for (int i = 0; i < entries.length; i++){
- IIncludePathEntry entry = entries[i];
- if (entry.getPath().toOSString().toLowerCase().equals(root.getPath().toOSString().toLowerCase())) {
- entries[i] = JavaScriptCore.newLibraryEntry(
- root.getPath(),
- sourcePath == null ? null : new Path(sourcePath),
- sourceRoot == null ? null : new Path(sourceRoot),
- false);
- break;
- }
- }
- javaProject.setRawIncludepath(entries, null);
- }
- /**
- * Creates an operation to delete the given element, asserts
- * the operation is successfull, and ensures the element is no
- * longer present in the model.
- */
- public void assertDeletion(IJavaScriptElement elementToDelete) throws JavaScriptModelException {
- assertDeletion(new IJavaScriptElement[] {elementToDelete});
- }
- /**
- * Empties the current deltas.
- */
- public void clearDeltas() {
- this.deltaListener.deltas = new IJavaScriptElementDelta[0];
- this.deltaListener.stackTraces = new ByteArrayOutputStream();
- }
- protected IJavaScriptElement[] codeSelect(ISourceReference sourceReference, String selectAt, String selection) throws JavaScriptModelException {
- String str = sourceReference.getSource();
- int start = str.indexOf(selectAt);
- int length = selection.length();
- return ((ICodeAssist)sourceReference).codeSelect(start, length);
- }
- protected IJavaScriptElement[] codeSelectAt(ISourceReference sourceReference, String selectAt) throws JavaScriptModelException {
- String str = sourceReference.getSource();
- int start = str.indexOf(selectAt) + selectAt.length();
- int length = 0;
- return ((ICodeAssist)sourceReference).codeSelect(start, length);
- }
- /**
- * Copy file from src (path to the original file) to dest (path to the destination file).
- */
- public void copy(File src, File dest) throws IOException {
- // read source bytes
- byte[] srcBytes = this.read(src);
-
- if (convertToIndependantLineDelimiter(src)) {
- String contents = new String(srcBytes);
- contents = org.eclipse.wst.jsdt.core.tests.util.Util.convertToIndependantLineDelimiter(contents);
- srcBytes = contents.getBytes();
- }
-
- // write bytes to dest
- FileOutputStream out = new FileOutputStream(dest);
- out.write(srcBytes);
- out.close();
- }
-
- public boolean convertToIndependantLineDelimiter(File file) {
- return file.getName().endsWith(".js");
- }
-
- /**
- * Copy the given source directory (and all its contents) to the given target directory.
- */
- protected void copyDirectory(File source, File target) throws IOException {
- if (!target.exists()) {
- target.mkdirs();
- }
- File[] files = source.listFiles();
- if (files == null) return;
- for (int i = 0; i < files.length; i++) {
- File sourceChild = files[i];
- String name = sourceChild.getName();
- if (name.equals("CVS") || name.equals(".svn")) continue;
- File targetChild = new File(target, name);
- if (sourceChild.isDirectory()) {
- copyDirectory(sourceChild, targetChild);
- } else {
- copy(sourceChild, targetChild);
- }
- }
- }
- protected IFolder createFolder(IPath path) throws CoreException {
- final IFolder folder = getWorkspaceRoot().getFolder(path);
- getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IContainer parent = folder.getParent();
- if (parent instanceof IFolder && !parent.exists()) {
- createFolder(parent.getFullPath());
- }
- folder.create(true, true, null);
- }
- },
- null);
-
- return folder;
- }
- /*
- * Creates a Java project where prj=src=bin and with JCL_LIB on its classpath.
- */
- protected IJavaScriptProject createJavaProject(String projectName) throws CoreException {
- return this.createJavaProject(projectName, new String[] {""}, new String[] {"JCL_LIB"});
- }
- /*
- * Creates a Java project with the given source folders an output location.
- * Add those on the project's classpath.
- */
- protected IJavaScriptProject createJavaProject(String projectName, String[] sourceFolders) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- null/*no lib*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no exported project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- "1.4"
- );
- }
- /*
- * Creates a Java project with the given source folders an output location.
- * Add those on the project's classpath.
- */
- protected IJavaScriptProject createJavaProject(String projectName, String[] sourceFolders, String output, String[] sourceOutputs) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- null/*no lib*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no exported project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- "1.4"
- );
- }
- protected IJavaScriptProject createJavaProject(String projectName, String[] sourceFolders, String[] libraries) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no exported project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- "1.4"
- );
- }
- protected IJavaScriptProject createJavaProject(String projectName, String[] sourceFolders, String[] libraries, String output, String compliance) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no exported project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- compliance
- );
- }
- protected IJavaScriptProject createJavaProject(String projectName, String[] sourceFolders, String[] libraries, String[] projects) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- projects,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no exported project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- "1.4"
- );
- }
- protected SearchPattern createPattern(IJavaScriptElement element, int limitTo) {
- return SearchPattern.createPattern(element, limitTo);
- }
- protected SearchPattern createPattern(String stringPattern, int searchFor, int limitTo, boolean isCaseSensitive) {
- int matchMode = stringPattern.indexOf('*') != -1 || stringPattern.indexOf('?') != -1
- ? SearchPattern.R_PATTERN_MATCH
- : SearchPattern.R_EXACT_MATCH;
- int matchRule = isCaseSensitive ? matchMode | SearchPattern.R_CASE_SENSITIVE : matchMode;
- return SearchPattern.createPattern(stringPattern, searchFor, limitTo, matchRule);
- }
- protected IJavaScriptProject createJavaProject(String projectName, String[] sourceFolders, String[] libraries, String[] projects, boolean[] exportedProject, String projectOutput) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- projects,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- exportedProject,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- "1.4"
- );
- }
- protected IJavaScriptProject createJavaProject(String projectName, String[] sourceFolders, String[] libraries, String[] projects, String projectOutput, String compliance) throws CoreException {
- return
- createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- projects,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- null/*no exported project*/,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- compliance
- );
- }
- protected IJavaScriptProject createJavaProject(final String projectName, final String[] sourceFolders, final String[] libraries, final String[] projects, final boolean[] exportedProjects, final String projectOutput, final String[] sourceOutputs, final String[][] inclusionPatterns, final String[][] exclusionPatterns, final String compliance) throws CoreException {
- return
- this.createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- projects,
- null/*no inclusion pattern*/,
- null/*no exclusion pattern*/,
- exportedProjects,
- inclusionPatterns,
- exclusionPatterns,
- compliance
- );
- }
- protected IJavaScriptProject createJavaProject(
- final String projectName,
- final String[] sourceFolders,
- final String[] libraries,
- final String[][] librariesInclusionPatterns,
- final String[][] librariesExclusionPatterns,
- final String[] projects,
- final String[][] projectsInclusionPatterns,
- final String[][] projectsExclusionPatterns,
- final boolean[] exportedProjects,
- final String[][] inclusionPatterns,
- final String[][] exclusionPatterns,
- final String compliance) throws CoreException {
- return createJavaProject(
- projectName,
- sourceFolders,
- libraries,
- librariesInclusionPatterns,
- librariesExclusionPatterns,
- projects,
- projectsInclusionPatterns,
- projectsExclusionPatterns,
- true, // combine access restrictions by default
- exportedProjects,
- inclusionPatterns,
- exclusionPatterns,
- compliance);
- }
- protected IJavaScriptProject createJavaProject(
- final String projectName,
- final String[] sourceFolders,
- final String[] libraries,
- final String[][] librariesInclusionPatterns,
- final String[][] librariesExclusionPatterns,
- final String[] projects,
- final String[][] projectsInclusionPatterns,
- final String[][] projectsExclusionPatterns,
- final boolean combineAccessRestrictions,
- final boolean[] exportedProjects,
- final String[][] inclusionPatterns,
- final String[][] exclusionPatterns,
- final String compliance) throws CoreException {
- final IJavaScriptProject[] result = new IJavaScriptProject[1];
- IWorkspaceRunnable create = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // create project
- createProject(projectName);
-
- // set java nature
- addJavaNature(projectName);
-
- // create classpath entries
-
- IProject project = getWorkspaceRoot().getProject(projectName);
- IPath projectPath = project.getFullPath();
- int sourceLength = sourceFolders == null ? 0 : sourceFolders.length;
- int libLength = libraries == null ? 0 : libraries.length;
- int projectLength = projects == null ? 0 : projects.length;
- /*
- *
- * Default JRE entry
- */
-
-
-
- IIncludePathEntry[] entries = new IIncludePathEntry[sourceLength+libLength+projectLength+1];
- for (int i= 0; i < sourceLength; i++) {
- IPath sourcePath = new Path(sourceFolders[i]);
- int segmentCount = sourcePath.segmentCount();
- if (segmentCount > 0) {
- // create folder and its parents
- IContainer container = project;
- for (int j = 0; j < segmentCount; j++) {
- IFolder folder = container.getFolder(new Path(sourcePath.segment(j)));
- if (!folder.exists()) {
- folder.create(true, true, null);
- }
- container = folder;
- }
- }
-
- // inclusion patterns
- IPath[] inclusionPaths;
- if (inclusionPatterns == null) {
- inclusionPaths = new IPath[0];
- } else {
- String[] patterns = inclusionPatterns[i];
- int length = patterns.length;
- inclusionPaths = new IPath[length];
- for (int j = 0; j < length; j++) {
- String inclusionPattern = patterns[j];
- inclusionPaths[j] = new Path(inclusionPattern);
- }
- }
- // exclusion patterns
- IPath[] exclusionPaths;
- if (exclusionPatterns == null) {
- exclusionPaths = new IPath[0];
- } else {
- String[] patterns = exclusionPatterns[i];
- int length = patterns.length;
- exclusionPaths = new IPath[length];
- for (int j = 0; j < length; j++) {
- String exclusionPattern = patterns[j];
- exclusionPaths[j] = new Path(exclusionPattern);
- }
- }
- // create source entry
- entries[i] =
- JavaScriptCore.newSourceEntry(
- projectPath.append(sourcePath),
- inclusionPaths,
- exclusionPaths,
- null
- );
- }
-
-
-
- for (int i= 0; i < libLength; i++) {
- String lib = libraries[i];
- if (lib.startsWith("JCL")) {
- try {
- // ensure JCL variables are set
- setUpJCLClasspathVariables(compliance);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- // accessible files
- IPath[] accessibleFiles;
- if (librariesInclusionPatterns == null) {
- accessibleFiles = new IPath[0];
- } else {
- String[] patterns = librariesInclusionPatterns[i];
- int length = patterns.length;
- accessibleFiles = new IPath[length];
- for (int j = 0; j < length; j++) {
- String inclusionPattern = patterns[j];
- accessibleFiles[j] = new Path(inclusionPattern);
- }
- }
- // non accessible files
- IPath[] nonAccessibleFiles;
- if (librariesExclusionPatterns == null) {
- nonAccessibleFiles = new IPath[0];
- } else {
- String[] patterns = librariesExclusionPatterns[i];
- int length = patterns.length;
- nonAccessibleFiles = new IPath[length];
- for (int j = 0; j < length; j++) {
- String exclusionPattern = patterns[j];
- nonAccessibleFiles[j] = new Path(exclusionPattern);
- }
- }
- if (lib.indexOf(File.separatorChar) == -1 && lib.charAt(0) != '/' && lib.equals(lib.toUpperCase())) { // all upper case is a var
- char[][] vars = CharOperation.splitOn(',', lib.toCharArray());
- entries[sourceLength+i] = JavaScriptCore.newVariableEntry(
- new Path(new String(vars[0])),
- vars.length > 1 ? new Path(new String(vars[1])) : null,
- vars.length > 2 ? new Path(new String(vars[2])) : null);
- } else if (lib.startsWith("org.eclipse.wst.jsdt.core.tests.model.")) { // container
- entries[sourceLength+i] = JavaScriptCore.newContainerEntry(
- new Path(lib),
- ClasspathEntry.getAccessRules(accessibleFiles, nonAccessibleFiles),
- new IIncludePathAttribute[0],
- false);
- } else {
- IPath libPath = new Path(lib);
- if (!libPath.isAbsolute() && libPath.segmentCount() > 0 && libPath.getFileExtension() == null) {
- project.getFolder(libPath).create(true, true, null);
- libPath = projectPath.append(libPath);
- }
- entries[sourceLength+i] = JavaScriptCore.newLibraryEntry(
- libPath,
- null,
- null,
- ClasspathEntry.getAccessRules(accessibleFiles, nonAccessibleFiles),
- new IIncludePathAttribute[0],
- false);
- }
- }
- for (int i= 0; i < projectLength; i++) {
- boolean isExported = exportedProjects != null && exportedProjects.length > i && exportedProjects[i];
-
- // accessible files
- IPath[] accessibleFiles;
- if (projectsInclusionPatterns == null) {
- accessibleFiles = new IPath[0];
- } else {
- String[] patterns = projectsInclusionPatterns[i];
- int length = patterns.length;
- accessibleFiles = new IPath[length];
- for (int j = 0; j < length; j++) {
- String inclusionPattern = patterns[j];
- accessibleFiles[j] = new Path(inclusionPattern);
- }
- }
- // non accessible files
- IPath[] nonAccessibleFiles;
- if (projectsExclusionPatterns == null) {
- nonAccessibleFiles = new IPath[0];
- } else {
- String[] patterns = projectsExclusionPatterns[i];
- int length = patterns.length;
- nonAccessibleFiles = new IPath[length];
- for (int j = 0; j < length; j++) {
- String exclusionPattern = patterns[j];
- nonAccessibleFiles[j] = new Path(exclusionPattern);
- }
- }
-
- entries[sourceLength+libLength+i] =
- JavaScriptCore.newProjectEntry(
- new Path(projects[i]),
- ClasspathEntry.getAccessRules(accessibleFiles, nonAccessibleFiles),
- combineAccessRestrictions,
- new IIncludePathAttribute[0],
- isExported);
- }
-
- // set classpath and output location
- IJavaScriptProject javaProject = JavaScriptCore.create(project);
-
-
-
-
- /* ensure system.js entry */
- IIncludePathEntry jreEntry = JavaScriptCore.newContainerEntry(new Path("org.eclipse.wst.jsdt.launching.JRE_CONTAINER"));
- entries[entries.length-1] = jreEntry;
-
-
- javaProject.setRawIncludepath(entries, null);
-
- // set compliance level options
- if ("1.5".equals(compliance)) {
- Map options = new HashMap();
- options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
- options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
- options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
- javaProject.setOptions(options);
- }
-
- result[0] = javaProject;
- }
- };
-
- getWorkspace().run(create, null);
-
-
- return result[0];
- }
- /*
- * Create simple project.
- */
- protected IProject createProject(final String projectName) throws CoreException {
- final IProject project = getProject(projectName);
- IWorkspaceRunnable create = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.create(null);
- project.open(null);
- }
- };
- getWorkspace().run(create, null);
- return project;
- }
- public void deleteFile(File file) {
- int retryCount = 0;
- while (++retryCount <= 60) { // wait 1 minute at most
- if (org.eclipse.wst.jsdt.core.tests.util.Util.delete(file)) {
- break;
- }
- }
- }
- protected void deleteFolder(IPath folderPath) throws CoreException {
- deleteResource(getFolder(folderPath));
- }
- protected void deleteProject(String projectName) throws CoreException {
- IProject project = this.getProject(projectName);
- if (project.exists() && !project.isOpen()) { // force opening so that project can be deleted without logging (see bug 23629)
- project.open(null);
- }
- deleteResource(project);
- }
- protected void deleteProject(IJavaScriptProject project) throws CoreException {
- if (project.exists() && !project.isOpen()) { // force opening so that project can be deleted without logging (see bug 23629)
- project.open(null);
- }
- deleteResource(project.getProject());
- }
-
- /**
- * Batch deletion of projects
- */
- protected void deleteProjects(final String[] projectNames) throws CoreException {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- if (projectNames != null){
- for (int i = 0, max = projectNames.length; i < max; i++){
- if (projectNames[i] != null)
- deleteProject(projectNames[i]);
- }
- }
- }
- },
- null);
- }
- /**
- * Delete this resource.
- */
- public void deleteResource(IResource resource) throws CoreException {
- int retryCount = 0; // wait 1 minute at most
- while (++retryCount <= 60) {
- if (!org.eclipse.wst.jsdt.core.tests.util.Util.delete(resource)) {
- System.gc();
- }
- }
- }
- /**
- * Returns true if this delta is flagged as having changed children.
- */
- protected boolean deltaChildrenChanged(IJavaScriptElementDelta delta) {
- return delta.getKind() == IJavaScriptElementDelta.CHANGED &&
- (delta.getFlags() & IJavaScriptElementDelta.F_CHILDREN) != 0;
- }
- /**
- * Returns true if this delta is flagged as having had a content change
- */
- protected boolean deltaContentChanged(IJavaScriptElementDelta delta) {
- return delta.getKind() == IJavaScriptElementDelta.CHANGED &&
- (delta.getFlags() & IJavaScriptElementDelta.F_CONTENT) != 0;
- }
- /**
- * Returns true if this delta is flagged as having moved from a location
- */
- protected boolean deltaMovedFrom(IJavaScriptElementDelta delta) {
- return delta.getKind() == IJavaScriptElementDelta.ADDED &&
- (delta.getFlags() & IJavaScriptElementDelta.F_MOVED_FROM) != 0;
- }
- /**
- * Returns true if this delta is flagged as having moved to a location
- */
- protected boolean deltaMovedTo(IJavaScriptElementDelta delta) {
- return delta.getKind() == IJavaScriptElementDelta.REMOVED &&
- (delta.getFlags() & IJavaScriptElementDelta.F_MOVED_TO) != 0;
- }
- /**
- * Ensure that the positioned element is in the correct position within the parent.
- */
- public void ensureCorrectPositioning(IParent container, IJavaScriptElement sibling, IJavaScriptElement positioned) throws JavaScriptModelException {
- IJavaScriptElement[] children = container.getChildren();
- if (sibling != null) {
- // find the sibling
- boolean found = false;
- for (int i = 0; i < children.length; i++) {
- if (children[i].equals(sibling)) {
- assertTrue("element should be before sibling", i > 0 && children[i - 1].equals(positioned));
- found = true;
- break;
- }
- }
- assertTrue("Did not find sibling", found);
- }
- }
- /**
- * Returns the specified compilation unit in the given project, root, and
- * package fragment or null
if it does not exist.
- */
- public IClassFile getClassFile(String projectName, String rootPath, String packageName, String className) throws JavaScriptModelException {
- IPackageFragment pkg= getPackageFragment(projectName, rootPath, packageName);
- if (pkg == null) {
- return null;
- }
- return pkg.getClassFile(className);
- }
- protected IJavaScriptUnit getCompilationUnit(String path) {
- return (IJavaScriptUnit)JavaScriptCore.create(getFile(path));
- }
- /**
- * Returns the specified compilation unit in the given project, root, and
- * package fragment or null
if it does not exist.
- */
- public IJavaScriptUnit getCompilationUnit(String projectName, String rootPath, String packageName, String cuName) throws JavaScriptModelException {
- IPackageFragment pkg= getPackageFragment(projectName, rootPath, packageName);
- if (pkg == null) {
- return null;
- }
- return pkg.getJavaScriptUnit(cuName);
- }
- /**
- * Returns the specified compilation unit in the given project, root, and
- * package fragment or null
if it does not exist.
- */
- public IJavaScriptUnit[] getCompilationUnits(String projectName, String rootPath, String packageName) throws JavaScriptModelException {
- IPackageFragment pkg= getPackageFragment(projectName, rootPath, packageName);
- if (pkg == null) {
- return null;
- }
- return pkg.getJavaScriptUnits();
- }
- protected IJavaScriptUnit getCompilationUnitFor(IJavaScriptElement element) {
-
- if (element instanceof IJavaScriptUnit) {
- return (IJavaScriptUnit)element;
- }
-
- if (element instanceof IMember) {
- return ((IMember)element).getJavaScriptUnit();
- }
-
- if (element instanceof IImportDeclaration) {
- return (IJavaScriptUnit)element.getParent();
- }
-
- return null;
-
- }
- /**
- * Returns the last delta for the given element from the cached delta.
- */
- protected IJavaScriptElementDelta getDeltaFor(IJavaScriptElement element) {
- return getDeltaFor(element, false);
- }
- /**
- * Returns the delta for the given element from the cached delta.
- * If the boolean is true returns the first delta found.
- */
- protected IJavaScriptElementDelta getDeltaFor(IJavaScriptElement element, boolean returnFirst) {
- IJavaScriptElementDelta[] deltas = this.deltaListener.deltas;
- if (deltas == null) return null;
- IJavaScriptElementDelta result = null;
- for (int i = 0; i < deltas.length; i++) {
- IJavaScriptElementDelta delta = searchForDelta(element, this.deltaListener.deltas[i]);
- if (delta != null) {
- if (returnFirst) {
- return delta;
- }
- result = delta;
- }
- }
- return result;
- }
-
- /**
- * Returns the IPath to the external java class library (e.g. jclMin.jar)
- */
- protected IPath getExternalJCLPath(String compliance) {
- return new Path(getExternalJCLPathString(compliance));
- }
-
- /**
- * Returns the java.io path to the external java class library (e.g. jclMin.jar)
- */
- protected String getExternalJCLPathString(String compliance) {
- return getSystemJsPathString();
-// return SystemLibraries.getLibraryPath("system.js");
-// return getExternalPath() + "jclMin" + compliance + ".jar";
- }
-
- protected IPath getSystemJsPath() {
- return new Path(getSystemJsPathString());
- }
-
- protected String getSystemJsPathString()
- {
- IPath targetRoot = (new Path(System.getProperty("user.dir"))).removeLastSegments(1);
- IPath pluginDir = targetRoot.append(new Path("org.eclipse.wst.jsdt.core"));
- IPath libDir = pluginDir.append(new Path(new String(SystemLibraryLocation.LIBRARY_PLUGIN_DIRECTORY)));
- IPath fullDir = libDir.append(new Path(new String(SystemLibraryLocation.SYSTEM_LIBARAY_NAME)));
- return fullDir.toOSString();
- }
-
- /**
- * Returns the IPath to the root source of the external java class library (e.g. "src")
- */
- protected IPath getExternalJCLRootSourcePath() {
- return new Path("src");
- }
- /**
- * Returns the IPath to the source of the external java class library (e.g. jclMinsrc.zip)
- */
- protected IPath getExternalJCLSourcePath() {
- return new Path(getExternalJCLSourcePathString(""));
- }
- /**
- * Returns the IPath to the source of the external java class library (e.g. jclMinsrc.zip)
- */
- protected IPath getExternalJCLSourcePath(String compliance) {
- return new Path(getExternalJCLSourcePathString(compliance));
- }
- /**
- * Returns the java.io path to the source of the external java class library (e.g. jclMinsrc.zip)
- */
- protected String getExternalJCLSourcePathString() {
- return getExternalJCLSourcePathString("");
- }
- /**
- * Returns the java.io path to the source of the external java class library (e.g. jclMinsrc.zip)
- */
- protected String getExternalJCLSourcePathString(String compliance) {
- return getExternalPath() + "jclMin" + compliance + "src.zip";
- }
- /*
- * Returns the OS path to the external directory that contains external jar files.
- * This path ends with a File.separatorChar.
- */
- protected String getExternalPath() {
- if (EXTERNAL_JAR_DIR_PATH == null)
- try {
- String path = getWorkspaceRoot().getLocation().toFile().getParentFile().getCanonicalPath();
- if (path.charAt(path.length()-1) != File.separatorChar)
- path += File.separatorChar;
- EXTERNAL_JAR_DIR_PATH = path;
- } catch (IOException e) {
- e.printStackTrace();
- }
- return EXTERNAL_JAR_DIR_PATH;
- }
- protected IFile getFile(String path) {
- return getWorkspaceRoot().getFile(new Path(path));
- }
- protected IFolder getFolder(IPath path) {
- return getWorkspaceRoot().getFolder(path);
- }
- /**
- * Returns the Java Model this test suite is running on.
- */
- public IJavaScriptModel getJavaModel() {
- return JavaScriptCore.create(getWorkspaceRoot());
- }
- /**
- * Returns the Java Project with the given name in this test
- * suite's model. This is a convenience method.
- */
- public IJavaScriptProject getJavaProject(String name) {
- IProject project = getProject(name);
- return JavaScriptCore.create(project);
- }
- protected ILocalVariable getLocalVariable(ISourceReference cu, String selectAt, String selection) throws JavaScriptModelException {
- IJavaScriptElement[] elements = codeSelect(cu, selectAt, selection);
- if (elements.length == 0) return null;
- if (elements[0] instanceof ILocalVariable) {
- return (ILocalVariable)elements[0];
- }
- return null;
- }
- protected ILocalVariable getLocalVariable(String cuPath, String selectAt, String selection) throws JavaScriptModelException {
- ISourceReference cu = getCompilationUnit(cuPath);
- return getLocalVariable(cu, selectAt, selection);
- }
- protected String getNameSource(String cuSource, IJavaScriptElement element) throws JavaScriptModelException {
- ISourceRange nameRange = ((IMember) element).getNameRange();
- int start = nameRange.getOffset();
- int end = start+nameRange.getLength();
- String actualSource = start >= 0 && end >= start ? cuSource.substring(start, end) : "";
- return actualSource;
- }
- /**
- * Returns the specified package fragment in the given project and root, or
- * null
if it does not exist.
- * The rootPath must be specified as a project relative path. The empty
- * path refers to the default package fragment.
- */
- public IPackageFragment getPackageFragment(String projectName, String rootPath, String packageName) throws JavaScriptModelException {
- IPackageFragmentRoot root= getPackageFragmentRoot(projectName, rootPath);
- if (root == null) {
- return null;
- }
- return root.getPackageFragment(packageName);
- }
- /**
- * Returns the specified package fragment root in the given project, or
- * null
if it does not exist.
- * If relative, the rootPath must be specified as a project relative path.
- * The empty path refers to the package fragment root that is the project
- * folder iteslf.
- * If absolute, the rootPath refers to either an external jar, or a resource
- * internal to the workspace
- */
- public IPackageFragmentRoot getPackageFragmentRoot(
- String projectName,
- String rootPath)
- throws JavaScriptModelException {
-
- IJavaScriptProject project = getJavaProject(projectName);
- if (project == null) {
- return null;
- }
- IPath path = new Path(rootPath);
- if (path.isAbsolute()) {
- IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- IResource resource = workspaceRoot.findMember(path);
- IPackageFragmentRoot root;
- if (resource == null) {
- // external jar
- root = project.getPackageFragmentRoot(rootPath);
- } else {
- // resource in the workspace
- root = project.getPackageFragmentRoot(resource);
- }
- return root;
- } else {
- IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
- if (roots == null || roots.length == 0) {
- return null;
- }
- for (int i = 0; i < roots.length; i++) {
- IPackageFragmentRoot root = roots[i];
- if (!root.isExternal()
- && root.getUnderlyingResource().getProjectRelativePath().equals(path)) {
- return root;
- }
- }
- }
- return null;
- }
- protected IProject getProject(String project) {
- return getWorkspaceRoot().getProject(project);
- }
- /**
- * Returns the OS path to the directory that contains this plugin.
- */
- protected String getPluginDirectoryPath() {
- try {
- URL platformURL = Platform.getBundle("org.eclipse.wst.jsdt.core.tests.model").getEntry("/");
- return new File(FileLocator.toFileURL(platformURL).getFile()).getAbsolutePath();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
- }
- public String getSourceWorkspacePath() {
- return getPluginDirectoryPath() + java.io.File.separator + "workspace";
- }
- public IJavaScriptUnit getWorkingCopy(String path, boolean computeProblems) throws JavaScriptModelException {
- return getWorkingCopy(path, "", computeProblems);
- }
- public IJavaScriptUnit getWorkingCopy(String path, String source) throws JavaScriptModelException {
- return getWorkingCopy(path, source, false);
- }
- public IJavaScriptUnit getWorkingCopy(String path, String source, boolean computeProblems) throws JavaScriptModelException {
- if (this.wcOwner == null) this.wcOwner = new WorkingCopyOwner() {};
- return getWorkingCopy(path, source, this.wcOwner, computeProblems);
- }
- public IJavaScriptUnit getWorkingCopy(String path, String source, WorkingCopyOwner owner, boolean computeProblems) throws JavaScriptModelException {
- IProblemRequestor problemRequestor = computeProblems
- ? new IProblemRequestor() {
- public void acceptProblem(IProblem problem) {}
- public void beginReporting() {}
- public void endReporting() {}
- public boolean isActive() {
- return true;
- }
- }
- : null;
- return getWorkingCopy(path, source, owner, problemRequestor);
- }
- public IJavaScriptUnit getWorkingCopy(String path, String source, WorkingCopyOwner owner, IProblemRequestor problemRequestor) throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = getCompilationUnit(path);
- if (owner != null)
- workingCopy = workingCopy.getWorkingCopy(owner, null/*no progress monitor*/);
- else
- workingCopy.becomeWorkingCopy(null/*no progress monitor*/);
- workingCopy.getBuffer().setContents(source);
- if (problemRequestor instanceof ProblemRequestor)
- ((ProblemRequestor) problemRequestor).initialize(source.toCharArray());
- workingCopy.makeConsistent(null/*no progress monitor*/);
- return workingCopy;
- }
- /**
- * Returns the IWorkspace this test suite is running on.
- */
- public IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
- public IWorkspaceRoot getWorkspaceRoot() {
- return getWorkspace().getRoot();
- }
- protected void discardWorkingCopies(IJavaScriptUnit[] units) throws JavaScriptModelException {
- if (units == null) return;
- for (int i = 0, length = units.length; i < length; i++)
- if (units[i] != null)
- units[i].discardWorkingCopy();
- }
-
- protected String displayString(String toPrint, int indent) {
- char[] toDisplay =
- CharOperation.replace(
- toPrint.toCharArray(),
- getSystemJsPathString().toCharArray(),
- "getSystemJsPathString()".toCharArray());
- toDisplay =
- CharOperation.replace(
- toDisplay,
- getExternalJCLPathString("1.5").toCharArray(),
- "getExternalJCLPathString(\"1.5\")".toCharArray());
- toDisplay =
- CharOperation.replace(
- toDisplay,
- org.eclipse.wst.jsdt.core.tests.util.Util.displayString(getExternalJCLSourcePathString(), 0).toCharArray(),
- "getExternalJCLSourcePathString()".toCharArray());
- toDisplay =
- CharOperation.replace(
- toDisplay,
- org.eclipse.wst.jsdt.core.tests.util.Util.displayString(getExternalJCLSourcePathString("1.5"), 0).toCharArray(),
- "getExternalJCLSourcePathString(\"1.5\")".toCharArray());
- toDisplay = org.eclipse.wst.jsdt.core.tests.util.Util.displayString(new String(toDisplay), indent).toCharArray();
- toDisplay =
- CharOperation.replace(
- toDisplay,
- "getExternalJCLPathString()".toCharArray(),
- ("\"+ getExternalJCLPathString() + \"").toCharArray());
- toDisplay =
- CharOperation.replace(
- toDisplay,
- "getExternalJCLPathString(\\\"1.5\\\")".toCharArray(),
- ("\"+ getExternalJCLPathString(\"1.5\") + \"").toCharArray());
- toDisplay =
- CharOperation.replace(
- toDisplay,
- "getExternalJCLSourcePathString()".toCharArray(),
- ("\"+ getExternalJCLSourcePathString() + \"").toCharArray());
- toDisplay =
- CharOperation.replace(
- toDisplay,
- "getExternalJCLSourcePathString(\\\"1.5\\\")".toCharArray(),
- ("\"+ getExternalJCLSourcePathString(\"1.5\") + \"").toCharArray());
- return new String(toDisplay);
- }
-
- protected IJavaScriptUnit newExternalWorkingCopy(String name, final String contents) throws JavaScriptModelException {
- return newExternalWorkingCopy(name, null/*no classpath*/, null/*no problem requestor*/, contents);
- }
- protected IJavaScriptUnit newExternalWorkingCopy(String name, IIncludePathEntry[] classpath, IProblemRequestor problemRequestor, final String contents) throws JavaScriptModelException {
- WorkingCopyOwner owner = new WorkingCopyOwner() {
- public IBuffer createBuffer(IJavaScriptUnit wc) {
- IBuffer buffer = super.createBuffer(wc);
- buffer.setContents(contents);
- return buffer;
- }
- };
- return owner.newWorkingCopy(name, classpath, null/*no progress monitor*/);
- }
-
- public byte[] read(java.io.File file) throws java.io.IOException {
- int fileLength;
- byte[] fileBytes = new byte[fileLength = (int) file.length()];
- java.io.FileInputStream stream = new java.io.FileInputStream(file);
- int bytesRead = 0;
- int lastReadSize = 0;
- while ((lastReadSize != -1) && (bytesRead != fileLength)) {
- lastReadSize = stream.read(fileBytes, bytesRead, fileLength - bytesRead);
- bytesRead += lastReadSize;
- }
- stream.close();
- return fileBytes;
- }
- protected void removeJavaNature(String projectName) throws CoreException {
- IProject project = this.getProject(projectName);
- IProjectDescription description = project.getDescription();
- description.setNatureIds(new String[] {});
- project.setDescription(description, null);
- }
- protected void removeLibrary(IJavaScriptProject javaProject, String jarName, String sourceZipName) throws CoreException, IOException {
- IProject project = javaProject.getProject();
- String projectPath = '/' + project.getName() + '/';
- removeLibraryEntry(javaProject, new Path(projectPath + jarName));
- org.eclipse.wst.jsdt.core.tests.util.Util.delete(project.getFile(jarName));
- if (sourceZipName != null && sourceZipName.length() != 0) {
- org.eclipse.wst.jsdt.core.tests.util.Util.delete(project.getFile(sourceZipName));
- }
- }
- protected void removeLibraryEntry(Path path) throws JavaScriptModelException {
- removeLibraryEntry(this.currentProject, path);
- }
- protected void removeLibraryEntry(IJavaScriptProject project, Path path) throws JavaScriptModelException {
- IIncludePathEntry[] entries = project.getRawIncludepath();
- int length = entries.length;
- IIncludePathEntry[] newEntries = null;
- for (int i = 0; i < length; i++) {
- IIncludePathEntry entry = entries[i];
- if (entry.getPath().equals(path)) {
- newEntries = new IIncludePathEntry[length-1];
- if (i > 0)
- System.arraycopy(entries, 0, newEntries, 0, i);
- if (i < length-1)
- System.arraycopy(entries, i+1, newEntries, i, length-1-i);
- break;
- }
- }
- if (newEntries != null)
- project.setRawIncludepath(newEntries, null);
- }
-
- /**
- * Returns a delta for the given element in the delta tree
- */
- protected IJavaScriptElementDelta searchForDelta(IJavaScriptElement element, IJavaScriptElementDelta delta) {
-
- if (delta == null) {
- return null;
- }
- if (delta.getElement().equals(element)) {
- return delta;
- }
- for (int i= 0; i < delta.getAffectedChildren().length; i++) {
- IJavaScriptElementDelta child= searchForDelta(element, delta.getAffectedChildren()[i]);
- if (child != null) {
- return child;
- }
- }
- return null;
- }
- protected void search(IJavaScriptElement element, int limitTo, IJavaScriptSearchScope scope, SearchRequestor requestor) throws CoreException {
- search(element, limitTo, SearchPattern.R_EXACT_MATCH|SearchPattern.R_CASE_SENSITIVE, scope, requestor);
- }
- protected void search(IJavaScriptElement element, int limitTo, int matchRule, IJavaScriptSearchScope scope, SearchRequestor requestor) throws CoreException {
- SearchPattern pattern = SearchPattern.createPattern(element, limitTo, matchRule);
- assertNotNull("Pattern should not be null", pattern);
- new SearchEngine().search(
- pattern,
- new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()},
- scope,
- requestor,
- null
- );
- }
- protected void search(String patternString, int searchFor, int limitTo, IJavaScriptSearchScope scope, SearchRequestor requestor) throws CoreException {
- search(patternString, searchFor, limitTo, SearchPattern.R_EXACT_MATCH|SearchPattern.R_CASE_SENSITIVE, scope, requestor);
- }
- protected void search(String patternString, int searchFor, int limitTo, int matchRule, IJavaScriptSearchScope scope, SearchRequestor requestor) throws CoreException {
- if (patternString.indexOf('*') != -1 || patternString.indexOf('?') != -1)
- matchRule |= SearchPattern.R_PATTERN_MATCH;
- SearchPattern pattern = SearchPattern.createPattern(
- patternString,
- searchFor,
- limitTo,
- matchRule);
- assertNotNull("Pattern should not be null", pattern);
- new SearchEngine().search(
- pattern,
- new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()},
- scope,
- requestor,
- null);
- }
-
- /*
- * Selection of java elements.
- */
-
- /*
- * Search several occurences of a selection in a compilation unit source and returns its start and length.
- * If occurence is negative, then perform a backward search from the end of file.
- * If selection starts or ends with a comment (to help identification in source), it is removed from returned selection info.
- */
- int[] selectionInfo(IJavaScriptUnit cu, String selection, int occurences) throws JavaScriptModelException {
- String source = cu.getSource();
- int index = occurences < 0 ? source.lastIndexOf(selection) : source.indexOf(selection);
- int max = Math.abs(occurences)-1;
- for (int n=0; index >= 0 && n= 0) {
- if (selection.startsWith("/**")) { // comment is before
- int start = source.indexOf("*/", index);
- if (start >=0) {
- return new int[] { start+2, selection.length()-(start+2-index) };
- } else {
- msg.append("' starts with an unterminated comment");
- }
- } else if (selection.endsWith("*/")) { // comment is after
- int end = source.lastIndexOf("/**", index+selection.length());
- if (end >=0) {
- return new int[] { index, index-end };
- } else {
- msg.append("' ends with an unstartted comment");
- }
- } else { // no comment => use whole selection
- return new int[] { index, selection.length() };
- }
- } else {
- msg.append("' was not found in ");
- }
- msg.append(cu.getElementName());
- msg.append(":\n");
- msg.append(source);
- assertTrue(msg.toString(), false);
- return null;
- }
-
- /**
- * Select a field in a compilation unit identified with the first occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @return IField
- * @throws JavaScriptModelException
- */
- protected IField selectField(IJavaScriptUnit unit, String selection) throws JavaScriptModelException {
- return selectField(unit, selection, 1);
- }
-
- /**
- * Select a field in a compilation unit identified with the nth occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @param occurences
- * @return IField
- * @throws JavaScriptModelException
- */
- protected IField selectField(IJavaScriptUnit unit, String selection, int occurences) throws JavaScriptModelException {
- return (IField) selectJavaElement(unit, selection, occurences, IJavaScriptElement.FIELD);
- }
-
- /**
- * Select a local variable in a compilation unit identified with the first occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @return IType
- * @throws JavaScriptModelException
- */
- protected ILocalVariable selectLocalVariable(IJavaScriptUnit unit, String selection) throws JavaScriptModelException {
- return selectLocalVariable(unit, selection, 1);
- }
-
- /**
- * Select a local variable in a compilation unit identified with the nth occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @param occurences
- * @return IType
- * @throws JavaScriptModelException
- */
- protected ILocalVariable selectLocalVariable(IJavaScriptUnit unit, String selection, int occurences) throws JavaScriptModelException {
- return (ILocalVariable) selectJavaElement(unit, selection, occurences, IJavaScriptElement.LOCAL_VARIABLE);
- }
-
- /**
- * Select a method in a compilation unit identified with the first occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @return IFunction
- * @throws JavaScriptModelException
- */
- protected IFunction selectMethod(IJavaScriptUnit unit, String selection) throws JavaScriptModelException {
- return selectMethod(unit, selection, 1);
- }
-
- /**
- * Select a method in a compilation unit identified with the nth occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @param occurences
- * @return IFunction
- * @throws JavaScriptModelException
- */
- protected IFunction selectMethod(IJavaScriptUnit unit, String selection, int occurences) throws JavaScriptModelException {
- return (IFunction) selectJavaElement(unit, selection, occurences, IJavaScriptElement.METHOD);
- }
-
- /**
- * Select a parameterized source method in a compilation unit identified with the first occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @return ParameterizedSourceMethod
- * @throws JavaScriptModelException
- */
- protected ResolvedSourceMethod selectParameterizedMethod(IJavaScriptUnit unit, String selection) throws JavaScriptModelException {
- return selectParameterizedMethod(unit, selection, 1);
- }
-
- /**
- * Select a parameterized source method in a compilation unit identified with the nth occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @param occurences
- * @return ParameterizedSourceMethod
- * @throws JavaScriptModelException
- */
- protected ResolvedSourceMethod selectParameterizedMethod(IJavaScriptUnit unit, String selection, int occurences) throws JavaScriptModelException {
- IFunction type = selectMethod(unit, selection, occurences);
- assertTrue("Not a parameterized source type: "+type.getElementName(), type instanceof ResolvedSourceMethod);
- return (ResolvedSourceMethod) type;
- }
-
- /**
- * Select a parameterized source type in a compilation unit identified with the first occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @return ParameterizedSourceType
- * @throws JavaScriptModelException
- */
- protected ResolvedSourceType selectParameterizedType(IJavaScriptUnit unit, String selection) throws JavaScriptModelException {
- return selectParameterizedType(unit, selection, 1);
- }
-
- /**
- * Select a parameterized source type in a compilation unit identified with the nth occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @param occurences
- * @return ParameterizedSourceType
- * @throws JavaScriptModelException
- */
- protected ResolvedSourceType selectParameterizedType(IJavaScriptUnit unit, String selection, int occurences) throws JavaScriptModelException {
- IType type = selectType(unit, selection, occurences);
- assertTrue("Not a parameterized source type: "+type.getElementName(), type instanceof ResolvedSourceType);
- return (ResolvedSourceType) type;
- }
-
- /**
- * Select a type in a compilation unit identified with the first occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @return IType
- * @throws JavaScriptModelException
- */
- protected IType selectType(IJavaScriptUnit unit, String selection) throws JavaScriptModelException {
- return selectType(unit, selection, 1);
- }
-
- /**
- * Select a type in a compilation unit identified with the nth occurence in the source of a given selection.
- * @param unit
- * @param selection
- * @param occurences
- * @return IType
- * @throws JavaScriptModelException
- */
- protected IType selectType(IJavaScriptUnit unit, String selection, int occurences) throws JavaScriptModelException {
- return (IType) selectJavaElement(unit, selection, occurences, IJavaScriptElement.TYPE);
- }
-
- /**
- * Select a java element in a compilation unit identified with the nth occurence in the source of a given selection.
- * Do not allow subclasses to call this method as we want to verify IJavaScriptElement kind.
- */
- IJavaScriptElement selectJavaElement(IJavaScriptUnit unit, String selection, int occurences, int elementType) throws JavaScriptModelException {
- int[] selectionPositions = selectionInfo(unit, selection, occurences);
- IJavaScriptElement[] elements = null;
- if (wcOwner == null) {
- elements = unit.codeSelect(selectionPositions[0], selectionPositions[1]);
- } else {
- elements = unit.codeSelect(selectionPositions[0], selectionPositions[1], wcOwner);
- }
- assertEquals("Invalid selection number", 1, elements.length);
- assertEquals("Invalid java element type: "+elements[0].getElementName(), elements[0].getElementType(), elementType);
- return elements[0];
- }
-
- /* ************
- * Suite set-ups *
- *************/
- /**
- * Sets the class path of the Java project.
- */
- public void setClasspath(IJavaScriptProject javaProject, IIncludePathEntry[] classpath) {
- try {
- javaProject.setRawIncludepath(classpath, null);
- } catch (JavaScriptModelException e) {
- assertTrue("failed to set classpath", false);
- }
- }
- /**
- * Check locally for the required JCL files, .jar and src.zip.
- * If not available, copy from the project resources.
- */
- public void setupExternalJCL(String jclName) throws IOException {
- String externalPath = getExternalPath();
- String separator = java.io.File.separator;
- String resourceJCLDir = getPluginDirectoryPath() + separator + "JCL";
- java.io.File jclDir = new java.io.File(externalPath);
- java.io.File jclMin =
- new java.io.File(externalPath + jclName + ".jar");
- java.io.File jclMinsrc = new java.io.File(externalPath + jclName + "src.zip");
- if (!jclDir.exists()) {
- if (!jclDir.mkdir()) {
- //mkdir failed
- throw new IOException("Could not create the directory " + jclDir);
- }
- //copy the two files to the JCL directory
- java.io.File resourceJCLMin =
- new java.io.File(resourceJCLDir + separator + jclName + ".jar");
- copy(resourceJCLMin, jclMin);
- java.io.File resourceJCLMinsrc =
- new java.io.File(resourceJCLDir + separator + jclName + "src.zip");
- copy(resourceJCLMinsrc, jclMinsrc);
- } else {
- //check that the two files, jclMin.jar and jclMinsrc.zip are present
- //copy either file that is missing or less recent than the one in workspace
- java.io.File resourceJCLMin =
- new java.io.File(resourceJCLDir + separator + jclName + ".jar");
- if ((jclMin.lastModified() < resourceJCLMin.lastModified())
- || (jclMin.length() != resourceJCLMin.length())) {
- copy(resourceJCLMin, jclMin);
- }
- java.io.File resourceJCLMinsrc =
- new java.io.File(resourceJCLDir + separator + jclName + "src.zip");
- if ((jclMinsrc.lastModified() < resourceJCLMinsrc.lastModified())
- || (jclMinsrc.length() != resourceJCLMinsrc.length())) {
- copy(resourceJCLMinsrc, jclMinsrc);
- }
- }
- }
- protected IJavaScriptProject setUpJavaProject(final String projectName) throws CoreException, IOException {
- this.currentProject = setUpJavaProject(projectName, "1.4");
- return this.currentProject;
- }
- protected IJavaScriptProject setUpJavaProject(final String projectName, String compliance) throws CoreException, IOException {
- // copy files in project from source workspace to target workspace
- String sourceWorkspacePath = getSourceWorkspacePath();
- String targetWorkspacePath = getWorkspaceRoot().getLocation().toFile().getCanonicalPath();
- copyDirectory(new File(sourceWorkspacePath, projectName), new File(targetWorkspacePath, projectName));
-
- // ensure variables are set
- setUpJCLClasspathVariables(compliance);
-
- // create project
- final IProject project = getWorkspaceRoot().getProject(projectName);
- IWorkspaceRunnable populate = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- project.create(null);
- project.open(null);
- }
- };
- getWorkspace().run(populate, null);
- IJavaScriptProject javaProject = JavaScriptCore.create(project);
- setUpProjectCompliance(javaProject, compliance);
- javaProject.setOption(JavaScriptCore.COMPILER_PB_UNUSED_LOCAL, JavaScriptCore.IGNORE);
- javaProject.setOption(JavaScriptCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaScriptCore.IGNORE);
- javaProject.setOption(JavaScriptCore.COMPILER_PB_FIELD_HIDING, JavaScriptCore.IGNORE);
- javaProject.setOption(JavaScriptCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaScriptCore.IGNORE);
- javaProject.setOption(JavaScriptCore.COMPILER_PB_TYPE_PARAMETER_HIDING, JavaScriptCore.IGNORE);
- return javaProject;
- }
-
- protected void setUpProjectCompliance(IJavaScriptProject javaProject, String compliance) throws JavaScriptModelException, IOException {
- // Look for version to set and return if that's already done
- String version = CompilerOptions.VERSION_1_4;
- String jclLibString = null;
- String newJclLibString = null;
- String newJclSrcString = null;
- switch (compliance.charAt(2)) {
- case '5':
- version = CompilerOptions.VERSION_1_5;
- if (version.equals(javaProject.getOption(CompilerOptions.OPTION_Compliance, false))) {
- return;
- }
- jclLibString = "JCL_LIB";
- newJclLibString = "JCL15_LIB";
- newJclSrcString = "JCL15_SRC";
- break;
- case '3':
- version = CompilerOptions.VERSION_1_3;
- default:
- if (version.equals(javaProject.getOption(CompilerOptions.OPTION_Compliance, false))) {
- return;
- }
- jclLibString = "JCL15_LIB";
- newJclLibString = "JCL_LIB";
- newJclSrcString = "JCL_SRC";
- break;
- }
-
- // ensure variables are set
- setUpJCLClasspathVariables(compliance);
-
- // set options
- Map options = new HashMap();
- options.put(CompilerOptions.OPTION_Compliance, version);
- options.put(CompilerOptions.OPTION_Source, version);
- options.put(CompilerOptions.OPTION_TargetPlatform, version);
- javaProject.setOptions(options);
-
- // replace JCL_LIB with JCL15_LIB, and JCL_SRC with JCL15_SRC
- IIncludePathEntry[] classpath = javaProject.getRawIncludepath();
- IPath jclLib = new Path(jclLibString);
- for (int i = 0, length = classpath.length; i < length; i++) {
- IIncludePathEntry entry = classpath[i];
- if (entry.getPath().equals(jclLib)) {
- classpath[i] = JavaScriptCore.newVariableEntry(
- new Path(newJclLibString),
- new Path(newJclSrcString),
- entry.getSourceAttachmentRootPath(),
- entry.getAccessRules(),
- new IIncludePathAttribute[0],
- entry.isExported());
- break;
- }
- }
- javaProject.setRawIncludepath(classpath, null);
- }
- public void setUpJCLClasspathVariables(String compliance) throws JavaScriptModelException, IOException {
- if ("1.5".equals(compliance)) {
- if (JavaScriptCore.getIncludepathVariable("JCL15_LIB") == null) {
-// setupExternalJCL("jclMin1.5");
- JavaScriptCore.setIncludepathVariables(
- new String[] {"JCL15_LIB", "JCL15_SRC", "JCL_SRCROOT"},
- new IPath[] {getExternalJCLPath(compliance), getExternalJCLSourcePath(compliance), getExternalJCLRootSourcePath()},
- null);
- }
- } else {
- if (JavaScriptCore.getIncludepathVariable("JCL_LIB") == null) {
-// setupExternalJCL("jclMin");
- JavaScriptCore.setIncludepathVariables(
- new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
- new IPath[] {getExternalJCLPath(""), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
- null);
- }
- }
- }
- public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- // ensure autobuilding is turned off
- IWorkspaceDescription description = getWorkspace().getDescription();
- if (description.isAutoBuilding()) {
- description.setAutoBuilding(false);
- getWorkspace().setDescription(description);
- }
- }
- protected void setUp () throws Exception {
- super.setUp();
- if (NameLookup.VERBOSE || BasicSearchEngine.VERBOSE || JavaModelManager.VERBOSE) {
- System.out.println("--------------------------------------------------------------------------------");
- System.out.println("Running test "+getName()+"...");
- }
- }
- protected void sortElements(IJavaScriptElement[] elements) {
- Util.Comparer comparer = new Util.Comparer() {
- public int compare(Object a, Object b) {
- JavaElement elementA = (JavaElement)a;
- JavaElement elementB = (JavaElement)b;
- char[] tempJCLPath = "".toCharArray();
- String idA = new String(CharOperation.replace(
- elementA.toStringWithAncestors().toCharArray(),
- getSystemJsPathString().toCharArray(),
- tempJCLPath));
- String idB = new String(CharOperation.replace(
- elementB.toStringWithAncestors().toCharArray(),
- getSystemJsPathString().toCharArray(),
- tempJCLPath));
- return idA.compareTo(idB);
- }
- };
- Util.sort(elements, comparer);
- }
- protected void sortResources(Object[] resources) {
- Util.Comparer comparer = new Util.Comparer() {
- public int compare(Object a, Object b) {
- IResource resourceA = (IResource)a;
- IResource resourceB = (IResource)b;
- return resourceA.getFullPath().toString().compareTo(resourceB.getFullPath().toString()); }
- };
- Util.sort(resources, comparer);
- }
- protected void sortTypes(IType[] types) {
- Util.Comparer comparer = new Util.Comparer() {
- public int compare(Object a, Object b) {
- IType typeA = (IType)a;
- IType typeB = (IType)b;
- return typeA.getFullyQualifiedName().compareTo(typeB.getFullyQualifiedName());
- }
- };
- Util.sort(types, comparer);
- }
- /*
- * Simulate a save/exit of the workspace
- */
- protected void simulateExit() throws CoreException {
- waitForAutoBuild();
- getWorkspace().save(true/*full save*/, null/*no progress*/);
- JavaModelManager.getJavaModelManager().shutdown();
- }
- /*
- * Simulate a save/exit/restart of the workspace
- */
- protected void simulateExitRestart() throws CoreException {
- simulateExit();
- simulateRestart();
- }
- /*
- * Simulate a restart of the workspace
- */
- protected void simulateRestart() throws CoreException {
- JavaModelManager.doNotUse(); // reset the MANAGER singleton
- JavaModelManager.getJavaModelManager().startup();
- new JavaCorePreferenceInitializer().initializeDefaultPreferences();
- }
- /**
- * Starts listening to element deltas, and queues them in fgDeltas.
- */
- public void startDeltas() {
- clearDeltas();
- JavaScriptCore.addElementChangedListener(this.deltaListener);
- }
- /**
- * Stops listening to element deltas, and clears the current deltas.
- */
- public void stopDeltas() {
- JavaScriptCore.removeElementChangedListener(this.deltaListener);
- clearDeltas();
- }
- protected IPath[] toIPathArray(String[] paths) {
- if (paths == null) return null;
- int length = paths.length;
- IPath[] result = new IPath[length];
- for (int i = 0; i < length; i++) {
- result[i] = new Path(paths[i]);
- }
- return result;
- }
- protected String toString(String[] strings) {
- return toString(strings, false/*don't add extra new line*/);
- }
- protected String toString(String[] strings, boolean addExtraNewLine) {
- if (strings == null) return "null";
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = strings.length; i < length; i++){
- buffer.append(strings[i]);
- if (addExtraNewLine || i < length - 1)
- buffer.append("\n");
- }
- return buffer.toString();
- }
- protected void tearDown() throws Exception {
- super.tearDown();
- if (this.workingCopies != null) {
- discardWorkingCopies(this.workingCopies);
- this.workingCopies = null;
- }
- this.wcOwner = null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.tests.model.SuiteOfTestCases#tearDownSuite()
- */
- public void tearDownSuite() throws Exception {
- super.tearDownSuite();
- }
-
- /**
- * Wait for autobuild notification to occur
- */
- public static void waitForAutoBuild() {
- boolean wasInterrupted = false;
- do {
- try {
- Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
- wasInterrupted = false;
- } catch (OperationCanceledException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- wasInterrupted = true;
- }
- } while (wasInterrupted);
- }
-
- public static void waitUntilIndexesReady() {
- // dummy query for waiting until the indexes are ready
- SearchEngine engine = new SearchEngine();
- IJavaScriptSearchScope scope = SearchEngine.createWorkspaceScope();
- try {
- engine.searchAllTypeNames(
- null,
- SearchPattern.R_EXACT_MATCH,
- "!@$#!@".toCharArray(),
- SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE,
- IJavaScriptSearchConstants.CLASS,
- scope,
- new TypeNameRequestor() {
- public void acceptType(
- int modifiers,
- char[] packageName,
- char[] simpleTypeName,
- char[][] enclosingTypeNames,
- String path) {}
- },
- IJavaScriptSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
- null);
- } catch (CoreException e) {
- }
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java
deleted file mode 100644
index 0e7f507..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java
+++ /dev/null
@@ -1,607 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.wst.jsdt.core.*;
-import org.eclipse.wst.jsdt.core.compiler.CharOperation;
-import org.eclipse.wst.jsdt.core.search.*;
-import org.eclipse.wst.jsdt.internal.compiler.problem.AbortCompilationUnit;
-import org.eclipse.wst.jsdt.internal.core.PackageFragment;
-//import org.eclipse.wst.jsdt.internal.core.ResolvedSourceMethod;
-//import org.eclipse.wst.jsdt.internal.core.ResolvedSourceType;
-import org.eclipse.wst.jsdt.internal.core.SourceRefElement;
-import org.eclipse.wst.jsdt.internal.core.search.matching.PatternLocator;
-
-/**
- * Abstract class for Java Search tests.
- */
-public class AbstractJavaSearchTests extends AbstractJavaModelTests implements IJavaScriptSearchConstants {
-
- public static List JAVA_SEARCH_SUITES = null;
- protected static IJavaScriptProject JAVA_PROJECT;
- protected static boolean COPY_DIRS = true;
- protected static int EXACT_RULE = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
- protected static int EQUIVALENT_RULE = EXACT_RULE | SearchPattern.R_EQUIVALENT_MATCH;
- protected static int ERASURE_RULE = EXACT_RULE | SearchPattern.R_ERASURE_MATCH;
- protected static int RAW_RULE = EXACT_RULE | SearchPattern.R_ERASURE_MATCH | SearchPattern.R_EQUIVALENT_MATCH;
-
-// IJavaScriptUnit[] workingCopies;
-// boolean discard;
-
- /**
- * Collects results as a string.
- */
- public static class JavaSearchResultCollector extends SearchRequestor {
- protected SearchMatch match;
- public StringBuffer results = new StringBuffer(), line;
- public boolean showAccuracy;
- public boolean showContext;
- public boolean showRule;
- public boolean showInsideDoc;
- public boolean showPotential = true;
- public boolean showProject;
- public boolean showSynthetic;
- public int showFlavors = 0;
- public int count = 0;
- public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException {
- count++;
- this.match = searchMatch;
- writeLine();
- if (line != null) {
- writeLineToResult();
- }
- }
- protected void writeLineToResult() {
- if (match.getAccuracy() == SearchMatch.A_ACCURATE || showPotential) {
- if (results.length() > 0) results.append("\n");
- results.append(line);
- }
- }
- protected void writeLine() throws CoreException {
- try {
- IResource resource = match.getResource();
- IJavaScriptElement element = getElement(match);
- line = new StringBuffer(getPathString(resource, element));
- if (this.showProject) {
- IProject project = element.getJavaScriptProject().getProject();
- line.append(" [in ");
- line.append(project.getName());
- line.append("]");
- }
- IJavaScriptUnit unit = null;
- if (element instanceof IFunction) {
- line.append(" ");
- IFunction method = (IFunction)element;
- append(method);
- unit = method.getJavaScriptUnit();
- } else if (element instanceof IType) {
- line.append(" ");
- IType type = (IType)element;
- append(type);
- unit = type.getJavaScriptUnit();
- } else if (element instanceof IField) {
- line.append(" ");
- IField field = (IField)element;
- append(field);
- unit = field.getJavaScriptUnit();
- } else if (element instanceof IInitializer) {
- line.append(" ");
- IInitializer initializer = (IInitializer)element;
- append(initializer);
- unit = initializer.getJavaScriptUnit();
- } else if (element instanceof IPackageFragment) {
- line.append(" ");
- append((IPackageFragment)element);
- } else if (element instanceof ILocalVariable) {
- line.append(" ");
- ILocalVariable localVar = (ILocalVariable)element;
- IJavaScriptElement parent = localVar.getParent();
- if (parent instanceof IInitializer) {
- IInitializer initializer = (IInitializer)parent;
- append(initializer);
- line.append(".");
- } else if (parent instanceof IFunction){ // IFunction
- IFunction method = (IFunction)parent;
- append(method);
- line.append(".");
- }
- line.append(localVar.getElementName());
- unit = (IJavaScriptUnit)localVar.getAncestor(IJavaScriptElement.JAVASCRIPT_UNIT);
- } else if (element instanceof IImportDeclaration) {
- IImportDeclaration importDeclaration = (IImportDeclaration)element;
- unit = (IJavaScriptUnit)importDeclaration.getAncestor(IJavaScriptElement.JAVASCRIPT_UNIT);
- }
- if (resource instanceof IFile) {
- char[] contents = getSource(resource, element, unit);
- int start = match.getOffset();
- int end = start + match.getLength();
- if (start == -1 || (contents != null && contents.length > 0)) { // retrieving attached source not implemented here
- line.append(" [");
- if (start > -1) {
- if (this.showContext) {
- int lineStart1 = CharOperation.lastIndexOf('\n', contents, 0, start);
- int lineStart2 = CharOperation.lastIndexOf('\r', contents, 0, start);
- int lineStart = Math.max(lineStart1, lineStart2) + 1;
- line.append(CharOperation.subarray(contents, lineStart, start));
- line.append("<");
- }
- line.append(CharOperation.subarray(contents, start, end));
- if (this.showContext) {
- line.append(">");
- int lineEnd1 = CharOperation.indexOf('\n', contents, end);
- int lineEnd2 = CharOperation.indexOf('\r', contents, end);
- int lineEnd = lineEnd1 > 0 && lineEnd2 > 0 ? Math.min(lineEnd1, lineEnd2) : Math.max(lineEnd1, lineEnd2);
- if (lineEnd == -1) lineEnd = contents.length;
- line.append(CharOperation.subarray(contents, end, lineEnd));
- }
- } else {
- line.append("No source");
- }
- line.append("]");
- }
- }
- if (this.showAccuracy) {
- line.append(" ");
- if (match.getAccuracy() == SearchMatch.A_ACCURATE) {
- if (this.showRule) {
- if (match.isExact()) {
- line.append("EXACT_");
- } else if (match.isEquivalent()) {
- line.append("EQUIVALENT_");
- } else if (match.isErasure()) {
- line.append("ERASURE_");
- } else {
- line.append("INVALID_RULE_");
- }
- if (match.isRaw()) {
- line.append("RAW_");
- }
- } else {
- line.append("EXACT_");
- }
- line.append("MATCH");
- } else {
- line.append("POTENTIAL_MATCH");
- }
- }
- if (this.showInsideDoc) {
- line.append(" ");
- if (match.isInsideDocComment()) {
- line.append("INSIDE_JAVADOC");
- } else {
- line.append("OUTSIDE_JAVADOC");
- }
- }
- if (this.showSynthetic) {
- if (match instanceof MethodReferenceMatch) {
- MethodReferenceMatch methRef = (MethodReferenceMatch) match;
- }
- }
- if (this.showFlavors > 0) {
- if (match instanceof MethodReferenceMatch) {
- MethodReferenceMatch methRef = (MethodReferenceMatch) match;
- if (methRef.isSuperInvocation() && showSuperInvocation()) {
- line.append(" SUPER INVOCATION");
- }
- }
- }
- } catch (JavaScriptModelException e) {
- results.append("\n");
- results.append(e.toString());
- }
- }
- private boolean showSuperInvocation() {
- return (this.showFlavors & PatternLocator.SUPER_INVOCATION_FLAVOR) != 0;
- }
- protected void append(IField field) throws JavaScriptModelException {
- append(field.getDeclaringType());
- line.append(".");
- line.append(field.getElementName());
- }
- private void append(IInitializer initializer) throws JavaScriptModelException {
- append(initializer.getDeclaringType());
- line.append(".");
- if (Flags.isStatic(initializer.getFlags())) {
- line.append("static ");
- }
- line.append("{}");
- }
- private void append(IFunction method) throws JavaScriptModelException {
- if (!method.isConstructor() && method.getReturnType()!=null) {
- line.append(Signature.toString(method.getReturnType()));
- line.append(" ");
- }
- if (method.getDeclaringType()!=null)
- {
- append(method.getDeclaringType());
- line.append(".");
- }
- if (!method.isConstructor()) {
- line.append(method.getElementName());
- }
- line.append("(");
- String[] parameters = method.getParameterTypes();
- boolean varargs = Flags.isVarargs(method.getFlags());
- for (int i = 0, length=parameters.length; i");
- } else {
- line.append(typeName);
- }
- if (isLocal) {
- line.append("#");
- line.append(((SourceRefElement)type).occurrenceCount);
- }
- }
- protected IJavaScriptElement getElement(SearchMatch searchMatch) {
- return (IJavaScriptElement) searchMatch.getElement();
- }
- protected String getPathString(IResource resource, IJavaScriptElement element) {
- String pathString;
- if (resource != null) {
- IPath path = resource.getProjectRelativePath();
- if (path.segmentCount() == 0) {
- IJavaScriptElement root = element;
- while (root != null && !(root instanceof IPackageFragmentRoot)) {
- root = root.getParent();
- }
- if (root != null) {
- IPackageFragmentRoot pkgFragmentRoot = (IPackageFragmentRoot)root;
- if (pkgFragmentRoot.isExternal()) {
- pathString = pkgFragmentRoot.getPath().toOSString();
- } else {
- pathString = pkgFragmentRoot.getPath().toString();
- }
- } else {
- pathString = "";
- }
- } else {
- pathString = path.toString();
- }
- } else {
- pathString = element.getPath().toString();
- }
- return pathString;
- }
- protected char[] getSource(IResource resource, IJavaScriptElement element, IJavaScriptUnit unit) throws CoreException {
- char[] contents = CharOperation.NO_CHAR;
- if ("js".equals(resource.getFileExtension())) {
- IJavaScriptUnit cu = (IJavaScriptUnit)element.getAncestor(IJavaScriptElement.JAVASCRIPT_UNIT);
- if (cu != null && cu.isWorkingCopy()) {
- // working copy
- contents = unit.getBuffer().getCharacters();
- } else {
- IFile file = ((IFile) resource);
- try {
- contents = new org.eclipse.wst.jsdt.internal.compiler.batch.CompilationUnit(
- null,
- file.getLocation().toFile().getPath(),
- file.getCharset()).getContents();
- } catch(AbortCompilationUnit e) {
- // TODO (philippe) occured with a FileNotFoundException
- // ignore
- }
- }
- }
- return contents;
- }
- public String toString() {
- return results.toString();
- }
- }
-
- static class TypeNameMatchCollector extends TypeNameMatchRequestor {
- List matches = new ArrayList();
- public void acceptTypeNameMatch(TypeNameMatch match) {
- IType type = match.getType();
- if (type != null) {
- this.matches.add(type);
- }
- }
- public int size() {
- return this.matches.size();
- }
- private String toString(int kind) {
- int size = size();
- if (size == 0) return "";
- String[] strings = new String[size];
- for (int i=0; i0) buffer.append('\n');
- buffer.append(strings[i]);
- }
- return buffer.toString();
- }
- public String toString() {
- return toString(0);
- }
- public String toFullyQualifiedNamesString() {
- return toString(1);
- }
- }
-
-protected JavaSearchResultCollector resultCollector;
-
- public AbstractJavaSearchTests(String name) {
- this(name, 2);
- }
- public AbstractJavaSearchTests(String name, int tabs) {
- super(name, tabs);
- this.displayName = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.tests.model.AbstractJavaModelTests#assertSearchResults(java.lang.String, java.lang.Object)
- */
- protected void assertSearchResults(String expected) {
- assertSearchResults(expected, resultCollector);
- }
- protected void assertSearchResults(String expected, JavaSearchResultCollector collector) {
- assertSearchResults("Unexpected search results", expected, collector);
- }
- protected void assertSearchResults(String message, String expected, JavaSearchResultCollector collector) {
- String actual = collector.toString();
- if (!expected.equals(actual)) {
- if (this.displayName) {
- System.out.print(getName());
- System.out.print(" got ");
- if (collector.count==0)
- System.out.println("no result!");
- else {
- System.out.print(collector.count);
- System.out.print(" result");
- if (collector.count==1)
- System.out.println(":");
- else
- System.out.println("s:");
- }
- }
- if (!displayName || collector.count>0) {
- System.out.print(displayString(actual, this.tabs));
- System.out.println(this.endChar);
- }
- if (this.workingCopies != null) {
- int length = this.workingCopies.length;
- String[] sources = new String[length*2];
- for (int i=0; i= 8 */
- protected final static int JAVADOC_RELEVANCE = R_DEFAULT + R_INTERESTING+ R_NON_RESTRICTED;
- /** R_DEFAULT+R_INTERESTING +R_UNQUALIFIED+R_NON_RESTRICTED = 11 */
- protected final static int R_DIUNR= R_DEFAULT+R_INTERESTING+R_UNQUALIFIED+R_NON_RESTRICTED;
- /** R_DEFAULT+R_INTERESTING+R_CASE +R_NON_RESTRICTED = 18 */
- protected static final int R_DICNR = R_DEFAULT+R_INTERESTING+R_CASE+R_NON_RESTRICTED;
- /** R_DEFAULT+R_INTERESTING+R_CASE +R_QUALIFIED+R_NON_RESTRICTED = 20 */
- protected static final int R_DICQNR = R_DEFAULT+R_INTERESTING+R_CASE+R_QUALIFIED+R_NON_RESTRICTED;
- /** R_DEFAULT+R_INTERESTING+R_CASE +R_UNQUALIFIED+R_NON_RESTRICTED = 21 */
- protected static final int R_DICUNR = R_DEFAULT+R_INTERESTING+R_CASE+R_UNQUALIFIED+R_NON_RESTRICTED;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_NON_RESTRICTED = 22 */
- protected static final int R_DICENNR = R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME+R_NON_RESTRICTED;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_QUALIFIED+R_NON_RESTRICTED = 24 */
- protected static final int R_DICENQNR = R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME+R_QUALIFIED+R_NON_RESTRICTED;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_UNQUALIFIED+R_NON_RESTRICTED = 25 */
- protected static final int R_DICENUNR = R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME+R_UNQUALIFIED+R_NON_RESTRICTED;
- /** R_DEFAULT+R_INTERESTING+R_CASE +R_NON_RESTRICTED+R_NON_STATIC = 29 */
- protected static final int R_DICNRNS = R_DEFAULT+R_INTERESTING+R_CASE+R_NON_RESTRICTED+R_NON_STATIC;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_NON_RESTRICTED+R_NON_STATIC = 33 */
- protected static final int R_DICENNRNS = R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME+R_NON_RESTRICTED+R_NON_STATIC;
-
- // Exception relevance values
- /** R_DEFAULT+R_INTERESTING+R_CASE +R_NON_RESTRICTED+R_EXCEPTION = 38 */
- protected static final int R_DICNRE = R_DICNR+R_EXCEPTION;
- /** R_DEFAULT+R_INTERESTING+R_CASE +R_UNQUALIFIED+R_NON_RESTRICTED+R_EXCEPTION = 41 */
- protected static final int R_DICUNRE = R_DICUNR+R_EXCEPTION;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_NON_RESTRICTED+R_EXCEPTION = 42 */
- protected static final int R_DICENNRE = R_DICENNR+R_EXCEPTION;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_UNQUALIFIED+R_NON_RESTRICTED+R_EXCEPTION = 45 */
- protected static final int R_DICENUNRE = R_DICENUNR+R_EXCEPTION;
-
- // Exact Expected relevance values
- /** R_DEFAULT+R_INTERESTING+R_CASE +R_NON_RESTRICTED+R_EXACT_EXPECTED_TYPE = 48 */
- protected static final int R_DICNREET = R_DICNR+R_EXACT_EXPECTED_TYPE;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_UNQUALIFIED +R_NON_RESTRICTED+R_EXACT_EXPECTED_TYPE = 51 */
- protected static final int R_DICUNREET = R_DICUNR+R_EXACT_EXPECTED_TYPE;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_UNQUALIFIED +R_NON_RESTRICTED+R_EXACT_EXPECTED_TYPE+R_EXCEPTION = 71 */
- protected static final int R_DICUNREETE = R_DICUNR+R_EXACT_EXPECTED_TYPE+R_EXCEPTION;
-
- // Exact Expected Exception relevance values
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_NON_RESTRICTED +R_EXCEPTION+R_EXACT_EXPECTED_TYPE = 68 */
- protected static final int R_DICNREEET = R_DICNRE+R_EXACT_EXPECTED_TYPE;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_UNQUALIFIED +R_NON_RESTRICTED+R_EXCEPTION
- * +R_EXACT_EXPECTED_TYPE = 71 */
- protected static final int R_DICUNREEET = R_DICUNRE+R_EXACT_EXPECTED_TYPE;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_NON_RESTRICTED+R_EXCEPTION
- * +R_EXACT_EXPECTED_TYPE = 72 */
- protected static final int R_DICENNREEET = R_DICENNRE+R_EXACT_EXPECTED_TYPE;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_UNQUALIFIED+R_NON_RESTRICTED+R_EXCEPTION
- * +R_EXACT_EXPECTED_TYPE = 75 */
- protected static final int R_DICENUNREEET = R_DICENUNRE+R_EXACT_EXPECTED_TYPE;
-
- // Inline tag relevance values
- /** R_DEFAULT+R_INTERESTING+R_NON_RESTRICTED +R_INLINE_TAG = 39 */
- protected static final int JAVADOC_RELEVANCE_IT = JAVADOC_RELEVANCE+R_INLINE_TAG;
- /** R_DEFAULT+R_INTERESTING+R_CASE +R_NON_RESTRICTED+R_INLINE_TAG = 49 */
- protected static final int R_DICNRIT = R_DICNR+R_INLINE_TAG;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_UNQUALIFIED +R_NON_RESTRICTED+R_INLINE_TAG = 52 */
- protected static final int R_DICUNRIT = R_DICUNR+R_INLINE_TAG;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_NON_RESTRICTED+R_INLINE_TAG = 53 */
- protected static final int R_DICENNRIT = R_DICENNR+R_INLINE_TAG;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME +R_UNQUALIFIED+R_NON_RESTRICTED+R_INLINE_TAG = 56 */
- protected static final int R_DICENUNRIT = R_DICENUNR+R_INLINE_TAG;
- /** R_DEFAULT+R_INTERESTING+R_CASE +R_NON_RESTRICTED+R_NON_STATIC+R_INLINE_TAG = 60 */
- protected static final int R_DICNRNSIT = R_DICNRNS+R_INLINE_TAG;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_NON_RESTRICTED +R_EXACT_EXPECTED_TYPE+R_INLINE_TAG = 79 */
- protected static final int R_DICNREETIT = R_DICNREET+R_INLINE_TAG;
- /** R_DEFAULT+R_INTERESTING+R_CASE+R_UNQUALIFIED +R_NON_RESTRICTED+R_EXACT_EXPECTED_TYPE
- * +R_INLINE_TAG = 82 */
- protected static final int R_DICUNREETIT = R_DICUNREET+R_INLINE_TAG;
-
- // Store all relevance values in array
- private static final int[] RELEVANCES = {
- JAVADOC_RELEVANCE,
- R_DIUNR,
- R_DICNR,
- R_DICQNR,
- R_DICUNR,
- R_DICENNR,
- R_DICENQNR,
- R_DICENUNR,
- R_DICNRNS,
- R_DICENNRNS,
- R_DICNRE,
- R_DICUNRE,
- R_DICENNRE,
- R_DICENUNRE,
- R_DICNREET,
- R_DICUNREET,
- R_DICNREEET,
- R_DICUNREEET,
- R_DICENNREEET,
- R_DICENUNREEET,
- JAVADOC_RELEVANCE_IT,
- R_DICNRIT,
- R_DICUNRIT,
- R_DICENNRIT,
- R_DICENUNRIT,
- R_DICNRNSIT,
- R_DICNREETIT,
- R_DICUNREETIT,
- };
- private static final String[] RELEVANCES_NAMES = {
- "JAVADOC_RELEVANCE",
- "R_DIUNR",
- "R_DICNR",
- "R_DICQNR",
- "R_DICUNR",
- "R_DICENNR",
- "R_DICENQNR",
- "R_DICENUNR",
- "R_DICNRNS",
- "R_DICENNRNS",
- "R_DICNRE",
- "R_DICUNRE",
- "R_DICENNRE",
- "R_DICENUNRE",
- "R_DICNREET",
- "R_DICUNREET",
- "R_DICNREEET",
- "R_DICUNREEET",
- "R_DICENNREEET",
- "R_DICENUNREEET",
- "JAVADOC_RELEVANCE_IT",
- "R_DICNRIT",
- "R_DICUNRIT",
- "R_DICENNRIT",
- "R_DICENUNRIT",
- "R_DICNRNSIT",
- "R_DICNREETIT",
- "R_DICUNREETIT",
- };
-
- // Write file contents
- protected static final String WRITE_DIR = System.getProperty("writeDir");
- protected static final File WRITE_DIR_FILE;
- protected static final Set PACKAGE_FILES = new HashSet();
- static {
- File writeDir = null;
- if (WRITE_DIR != null) {
- // Create write directory if necessay
- writeDir = new File(WRITE_DIR);
- if (writeDir.exists()) {
- // perhaps delete all files...
- } else if (!writeDir.mkdirs()) {
- System.err.println(WRITE_DIR+" does NOT exist and cannot be created!!!");
- writeDir = null;
- }
-
- }
- WRITE_DIR_FILE = writeDir;
- }
-
- CompletionTestsRequestor2 requestor;
- protected int cursorLocation;
- protected int completionStart;
- protected String replacedText;
- protected String positions;
-
- public AbstractJavadocCompletionModelTest(String name) {
- super(name);
- this.tabs = 2;
- this.displayName = true;
- this.endChar = "";
- }
-
- public static Test suite() {
- return buildModelTestSuite(AbstractJavadocCompletionModelTest.class);
- }
- protected void assertResults(String expected) throws JavaScriptModelException {
- int length = this.workingCopies.length;
- String[] sources = new String[length*2];
- for (int i=0; i0) {
- System.out.println(displayString(actual, this.tabs));
- System.out.println(this.endChar);
- }
- System.out.println("--------------------------------------------------------------------------------");
- for (int i=0, length = sources.length; i 0) {
- System.out.println("********************************************************************************");
- if (this.displayName) {
- System.out.print(getName());
- System.out.println(" contains an error although it should NOT:");
- }
- System.out.println(displayString(problem, this.tabs));
- System.out.println("--------------------------------------------------------------------------------");
- System.out.println(this.workingCopies[0].getPath().toString()+'\n');
- try {
- System.out.println(this.workingCopies[0].getSource());
- } catch (JavaScriptModelException e) {
- // forget it
- }
- assertEquals(
- path+" should have NO problem!",
- "",
- problem
- );
- }
- }
-
- protected void completeInJavadoc(String path, String source, boolean showPositions, String completeBehind) throws JavaScriptModelException {
- completeInJavadoc(path, source, showPositions, completeBehind, 1 /* first index */);
- }
-
- protected void completeInJavadoc(String path, String source, boolean showPositions, String completeBehind, boolean last) throws JavaScriptModelException {
- completeInJavadoc(path, source, showPositions, completeBehind, last ? -1 : 1);
- }
-
- protected void completeInJavadoc(String path, String source, boolean showPositions, String completeBehind, int occurencePosition) throws JavaScriptModelException {
- completeInJavadoc(new String[] { path, source }, showPositions, completeBehind, occurencePosition, null);
- }
-
- protected void completeInJavadoc(String path, String source, boolean showPositions, String completeBehind, int occurencePosition, int[] ignoreList) throws JavaScriptModelException {
- completeInJavadoc(new String[] { path, source }, showPositions, completeBehind, occurencePosition, ignoreList);
- }
- protected void completeInJavadoc(String[] sources, boolean showPositions, String completeBehind) throws JavaScriptModelException {
- completeInJavadoc(sources, showPositions, completeBehind, 1, null);
- }
-
- protected void completeInJavadoc(String[] sources, boolean showPositions, String completeBehind, int occurencePosition) throws JavaScriptModelException {
- completeInJavadoc(sources, showPositions, completeBehind, occurencePosition, null);
- }
-
- protected void completeInJavadoc(String[] sources, boolean showPositions, String completeBehind, int occurencePosition, int[] ignoreList) throws JavaScriptModelException {
- assertNotNull("We should have sources!!!", sources);
- assertTrue("Invalid number of sources!!!", sources.length%2==0);
-
- // Build working copy(ies)
- int length = sources.length / 2;
- this.workingCopies = new IJavaScriptUnit[length];
- for (int i=0; i0; i++) {
- this.completionStart = source.indexOf(this.replacedText, this.completionStart+shift);
- }
- }
- assertTrue("We should have found "+occurencePosition+" occurence(s) of '"+this.replacedText+"' in:\n"+source, this.completionStart>0);
- this.cursorLocation = this.completionStart + cursorPos;
- this.workingCopies[0].codeComplete(this.cursorLocation, requestor, this.wcOwner);
- assertNoProblem(sources[0]);
-
- // Store replacement info
- if (occurencePosition == 0) { // special case for completion on empty token...
- this.completionStart = this.cursorLocation;
- }
- int endPosition = this.cursorLocation;
- char ch = source.charAt(endPosition);
- if (Character.isJavaIdentifierPart(ch) || ch == '>' || ch == '}' || ch == '(' || ch == ')') {
- do {
- ch = source.charAt(++endPosition);
- } while (Character.isJavaIdentifierPart(ch) || ch == '>' || ch == '}' || ch == '(' || ch == ')');
- }
- this.positions = "["+this.completionStart+", "+endPosition+"], ";
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.tests.model.AbstractJavaModelTests#displayString(java.lang.String, int)
- */
- protected String displayString(String toPrint, int indent) {
- String toDisplay = super.displayString(toPrint, indent);
- int openBracket = toDisplay.indexOf(", [");
- if (openBracket > 0) {
- StringBuffer buffer = new StringBuffer();
- int closeBracket = 0;
- while (openBracket > 0) {
- buffer.append(toDisplay.substring(closeBracket, openBracket+2));
- closeBracket = toDisplay.indexOf("], ", openBracket+3);
- if (closeBracket < 0) break; // invalid
- closeBracket += 3;
- buffer.append("\"+this.positions+");
- int i=0;
- while (toDisplay.charAt(closeBracket+i) != '}') i++;
- try {
- int relevance = Integer.parseInt(toDisplay.substring(closeBracket, closeBracket+i));
- int length = RELEVANCES.length;
- boolean found = false;
- for (int r=0; !found && r 0) {
- buffer.append(toDisplay.substring(closeBracket, toDisplay.length()));
- toDisplay = buffer.toString();
- }
- }
- return toDisplay.replaceAll(", 8}", ", \"+JAVADOC_RELEVANCE+\"}");
- }
-
- protected void setUpProjectOptions(String compliance) throws JavaScriptModelException {
- try {
- setUpProjectCompliance(COMPLETION_PROJECT, compliance);
- } catch (IOException e) {
- assertTrue("Unexpected IOException: "+e.getMessage(), false);
- }
- }
-
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- if (COMPLETION_PROJECT == null) {
- COMPLETION_PROJECT = setUpJavaProject("Completion");
- createFolder(new Path("/Completion/src/javadoc/tags"));
- } else {
- setUpProjectCompliance(COMPLETION_PROJECT, "1.4");
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.tests.model.AbstractJavaModelTests#tearDown()
- */
- protected void tearDown() throws Exception {
- this.requestor = null;
- super.tearDown();
- }
-
- public void tearDownSuite() throws Exception {
- deleteFolder(new Path("/Completion/src/javadoc/tags"));
- super.tearDownSuite();
- if (COMPLETION_SUITES == null) {
- COMPLETION_PROJECT = null;
- }
- }
-
- /*
- * Write files for self-hosting debug.
- */
- protected void writeFiles(String[] sources) {
-
- // Get write directory path
- if (WRITE_DIR_FILE == null) return;
-
- // Get test name
- String testName = getName();
- int idx = testName.indexOf(" - ");
- if (idx > 0) {
- testName = testName.substring(idx+3);
- }
-// testName = "Test"+testName.substring(4);
-
- // Write sources to dir
- int length = sources.length / 2;
- String[][] names = new String[length][3];
- for (int i=0; i" will be run for each number of this array
- //TESTS_NUMBERS = new int[] { 1 };
- // Range numbers of tests to run: all tests between "test" and "test" will be run for { first, last }
- //TESTS_RANGE = new int[] { 16, -1 };
- }
-
- public static Test suite() {
- return buildModelTestSuite(AccessRestrictionsTests.class);
- }
-
- protected void assertProblems(String message, String expected) {
- assertProblems(message, expected, this.problemRequestor);
- }
-
-/*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76266
- * Ensures that a problem is created for a reference to a method of a type that is not
- * accessible in a prereq project, even though it is accessed through an intermediate
- * accessible class.
- */
-public void test001() throws CoreException {
- IJavaScriptUnit x1 = null, x2 = null, y = null, z = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- this.problemRequestor = new ProblemRequestor();
- x1 = getWorkingCopy(
- "/P1/src/p/X1.js",
- "package p;\n" +
- "public class X1 {\n" +
- " void foo() {\n" +
- " }\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- x2 = getWorkingCopy(
- "/P1/src/p/X2.js",
- "package p;\n" +
- "public class X2 extends X1 {\n" +
- " void bar() {\n" +
- " }\n" +
- "}", owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject("P2", new String[] {"src"},
- new String[] {"JCL_LIB"});
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0, classpath = new IIncludePathEntry[length+1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "-p/X1");
- p2.setRawIncludepath(classpath, null);
- // check the most basic case
- String src =
- "package p;\n" +
- "public class Z extends X1 {\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- z = getWorkingCopy(
- "/P2/src/p/Z.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/p/Z.java (at line 2)\n" +
- " public class Z extends X1 {\n" +
- " ^^\n" +
- "Access restriction: The type X1 is not accessible due to restriction on required project P1\n" +
- "----------\n"
- );
- // check the specifics of this test case
- src =
- "package p;\n" +
- "public class Y extends X2 {\n" +
- " void foobar() {\n" +
- " foo(); // accesses X1.foo, should trigger an error\n" +
- " bar(); // accesses X2.bar, OK\n" +
- " }\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- y = getWorkingCopy(
- "/P2/src/p/Y.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " foo(); // accesses X1.foo, should trigger an error\n" +
- " ^^^^^\n" +
- "Access restriction: The method foo() from the type X1 is not accessible due to restriction on required project P1\n" +
- "----------\n"
- );
- } finally {
- if (x1 != null)
- x1.discardWorkingCopy();
- if (x2 != null)
- x2.discardWorkingCopy();
- if (y != null)
- y.discardWorkingCopy();
- if (z != null)
- z.discardWorkingCopy();
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-/*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76266
- * Ensures that a problem is created for a reference to a field of a type that is not
- * accessible in a prereq project, even though it is accessed through an intermediate
- * accessible class.
- */
-public void test002() throws CoreException {
- IJavaScriptUnit x1 = null, x2 = null, y = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- this.problemRequestor = new ProblemRequestor();
- x1 = getWorkingCopy(
- "/P1/src/p/X1.js",
- "package p;\n" +
- "public class X1 {\n" +
- " int m1;\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- x2 = getWorkingCopy(
- "/P1/src/p/X2.js",
- "package p;\n" +
- "public class X2 extends X1 {\n" +
- " char m2;\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject("P2", new String[] {"src"},
- new String[] {"JCL_LIB"});
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0, classpath = new IIncludePathEntry[length+1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "-p/X1");
- p2.setRawIncludepath(classpath, null);
- String src =
- "package p;\n" +
- "public class Y extends X2 {\n" +
- " void foobar() {\n" +
- " int l1 = m1; // accesses X1.m1, should trigger an error\n" +
- " char l2 = m2; // accesses X2.m2, OK\n" +
- " }\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- y = getWorkingCopy(
- "/P2/src/p/Y.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " int l1 = m1; // accesses X1.m1, should trigger an error\n" +
- " ^^\n" +
- "Access restriction: The field m1 from the type X1 is not accessible due to restriction on required project P1\n" +
- "----------\n"
- );
- } finally {
- if (x1 != null)
- x1.discardWorkingCopy();
- if (x2 != null)
- x2.discardWorkingCopy();
- if (y != null)
- y.discardWorkingCopy();
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-/*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76266
- * Ensures that a problem is created for a reference to a member type of a type that is not
- * accessible in a prereq project, even though it is accessed through an intermediate
- * accessible class.
- */
-public void test003() throws CoreException {
- IJavaScriptUnit x1 = null, x2 = null, y = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- this.problemRequestor = new ProblemRequestor();
- x1 = getWorkingCopy(
- "/P1/src/p/X1.js",
- "package p;\n" +
- "public class X1 {\n" +
- " class C1 {\n" +
- " protected C1 (int dummy) {}\n" +
- " protected void foo() {}\n" +
- " }\n" +
- " interface I1 {}\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- x2 = getWorkingCopy(
- "/P1/src/p/X2.js",
- "package p;\n" +
- "public class X2 extends X1 {\n" +
- " class C2 {}\n" +
- " interface I2 {}\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject("P2", new String[] {"src"},
- new String[] {"JCL_LIB"});
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0, classpath = new IIncludePathEntry[length+1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "-p/X1");
- p2.setRawIncludepath(classpath, null);
- String src =
- "package p;\n" +
- "public class Y extends X2 {\n" +
- " class C3a extends C1 { // error\n" +
- " C3a() {\n" +
- " super(0);\n" +
- " foo(); // error\n" +
- " }\n" +
- " }\n" +
- " class C3c extends C2 implements I2 {}\n" +
- " void foobar() {\n" +
- " C1 m1 = // error\n" +
- " new C1(0); // error\n" +
- " C2 m2 = new C2();\n" +
- " }\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- y = getWorkingCopy(
- "/P2/src/p/Y.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/p/Y.java (at line 3)\n" +
- " class C3a extends C1 { // error\n" +
- " ^^\n" +
- "Access restriction: The type X1.C1 is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "2. ERROR in /P2/src/p/Y.java (at line 5)\n" +
- " super(0);\n" +
- " ^^^^^^^^^\n" +
- "Access restriction: The constructor X1.C1(int) is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "3. ERROR in /P2/src/p/Y.java (at line 6)\n" +
- " foo(); // error\n" +
- " ^^^^^\n" +
- "Access restriction: The method foo() from the type X1.C1 is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "4. ERROR in /P2/src/p/Y.java (at line 11)\n" +
- " C1 m1 = // error\n" +
- " ^^\n" +
- "Access restriction: The type X1.C1 is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "5. ERROR in /P2/src/p/Y.java (at line 12)\n" +
- " new C1(0); // error\n" +
- " ^^^^^^^^^\n" +
- "Access restriction: The constructor X1.C1(int) is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "6. ERROR in /P2/src/p/Y.java (at line 12)\n" +
- " new C1(0); // error\n" +
- " ^^\n" +
- "Access restriction: The type X1.C1 is not accessible due to restriction on required project P1\n" +
- "----------\n"
- );
- } finally {
- if (x1 != null)
- x1.discardWorkingCopy();
- if (x2 != null)
- x2.discardWorkingCopy();
- if (y != null)
- y.discardWorkingCopy();
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-/*
- * Discouraged access message - type via discouraged rule.
- */
-public void test004() throws CoreException {
- IJavaScriptUnit x1 = null, z = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- this.problemRequestor = new ProblemRequestor();
- x1 = getWorkingCopy(
- "/P1/src/p/X1.js",
- "package p;\n" +
- "public class X1 {\n" +
- " class C1 {}\n" +
- " interface I1 {}\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject("P2", new String[] {"src"},
- new String[] {"JCL_LIB"});
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0, classpath = new IIncludePathEntry[length+1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "~p/X1");
- p2.setRawIncludepath(classpath, null);
- String src =
- "package p;\n" +
- "public class Z extends X1 {\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- z = getWorkingCopy(
- "/P2/src/p/Z.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. WARNING in /P2/src/p/Z.java (at line 2)\n" +
- " public class Z extends X1 {\n" +
- " ^^\n" +
- "Discouraged access: The type X1 is not accessible due to restriction on required project P1\n" +
- "----------\n"
- );
- } finally {
- if (x1 != null)
- x1.discardWorkingCopy();
- if (z != null)
- z.discardWorkingCopy();
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-/*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76266
- * Ensures that a problem is created for a reference to a method of a type that is not
- * accessible in a prereq project, even though it is accessed through an intermediate
- * class that implements an interface that defines the same method, both the second
- * class and the interface being accessible.
- * The point here is that the existence of the accessible interface may imply that the
- * foo method be accessible through X2. By design, the lookup returns X1#foo though,
- * like it does for a press upon F3 in the interface, and hence the access restriction
- * gets triggered. Rule of thumb: if pressing F3 on a method or field directs the
- * interface to a definition within a restricted type, then the use of the said method
- * or field is restricted.
- */
-public void test005() throws CoreException {
- IJavaScriptUnit x1 = null, i1 = null, x2 = null, y = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- this.problemRequestor = new ProblemRequestor();
- x1 = getWorkingCopy(
- "/P1/src/p/X1.js",
- "package p;\n" +
- "public class X1 {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- i1 = getWorkingCopy(
- "/P1/src/q/I1.js",
- "package q;\n" +
- "interface I1 {\n" +
- " void foo();\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- x2 = getWorkingCopy(
- "/P1/src/q/X2.js",
- "package q;\n" +
- "public class X2 extends p.X1 {\n" +
- " public void bar() {\n" +
- " foo();\n" +
- " }\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject(
- "P2",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0,
- classpath = new IIncludePathEntry[length + 1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "-p/X1");
- p2.setRawIncludepath(classpath, null);
- String src =
- "package r;\n" +
- "public class Y {\n" +
- " void foobar() {\n" +
- " (new q.X2()).foo(); // accesses p.X1#foo, should trigger an error\n" +
- " (new q.X2()).bar(); // accesses q.X2#bar, OK\n" +
- " }\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- y = getWorkingCopy(
- "/P2/src/r/Y.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/r/Y.java (at line 4)\n" +
- " (new q.X2()).foo(); // accesses p.X1#foo, should trigger an error\n" +
- " ^^^^^^^^^^^^^^^^^^\n" +
- "Access restriction: The method foo() from the type X1 is not accessible due to restriction on required project P1\n" +
- "----------\n"
- );
- } finally {
- if (x1 != null)
- x1.discardWorkingCopy();
- if (i1 != null)
- i1.discardWorkingCopy();
- if (x2 != null)
- x2.discardWorkingCopy();
- if (y != null)
- y.discardWorkingCopy();
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-/*
- * Missing access restriction violation error on generic type.
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=122995
- */
-public void test006() throws CoreException {
- IJavaScriptUnit x = null, y = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- IJavaScriptProject p1 = createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- p1.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE);
- this.problemRequestor = new ProblemRequestor();
- x = getWorkingCopy(
- "/P1/src/p/X.js",
- "package p;\n" +
- "public class X {\n" +
- " T m;\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject(
- "P2",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- p2.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE);
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0, classpath = new IIncludePathEntry[length+1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "-p/X");
- p2.setRawIncludepath(classpath, null);
- String src =
- "package p;\n" +
- "public class Y {\n" +
- " X x1;\n" +
- " X x2 = new X();\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- y = getWorkingCopy(
- "/P2/src/p/Y.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/p/Y.java (at line 3)\n" +
- " X x1;\n" +
- " ^\n" +
- "Access restriction: The type X is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "2. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " X x2 = new X();\n" +
- " ^\n" +
- "Access restriction: The type X is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "3. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " X x2 = new X();\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "Access restriction: The constructor X() is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "4. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " X x2 = new X();\n" +
- " ^\n" +
- "Access restriction: The type X is not accessible due to restriction on required project P1\n" +
- "----------\n");
- } finally {
- if (x != null) {
- x.discardWorkingCopy();
- }
- if (y != null) {
- y.discardWorkingCopy();
- }
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-/*
- * Missing access restriction violation error on generic type.
- * More complex type parameter - stretch the erasure.
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=122995
- */
-public void test007() throws CoreException {
- IJavaScriptUnit x = null, y = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- IJavaScriptProject p1 = createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- p1.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE);
- this.problemRequestor = new ProblemRequestor();
- x = getWorkingCopy(
- "/P1/src/p/X.js",
- "package p;\n" +
- "public class X {\n" +
- " T m;\n" +
- " public X (T t) {\n" +
- " this.m = t;\n" +
- " }\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject(
- "P2",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- p2.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE);
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0, classpath = new IIncludePathEntry[length+1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "-p/X");
- p2.setRawIncludepath(classpath, null);
- String src =
- "package p;\n" +
- "public class Y {\n" +
- " X x1;\n" +
- " X x2 = new X(\"\");\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- y = getWorkingCopy(
- "/P2/src/p/Y.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/p/Y.java (at line 3)\n" +
- " X x1;\n" +
- " ^\n" +
- "Access restriction: The type X is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "2. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " X x2 = new X(\"\");\n" +
- " ^\n" +
- "Access restriction: The type X is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "3. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " X x2 = new X(\"\");\n" +
- " ^^^^^^^^^^^^^^^^^\n" +
- "Access restriction: The constructor X(String) is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "4. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " X x2 = new X(\"\");\n" +
- " ^\n" +
- "Access restriction: The type X is not accessible due to restriction on required project P1\n" +
- "----------\n");
- } finally {
- if (x != null) {
- x.discardWorkingCopy();
- }
- if (y != null) {
- y.discardWorkingCopy();
- }
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-/*
- * Missing access restriction violation error on generic type.
- * Method case.
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=122995
- */
-public void test008() throws CoreException {
- IJavaScriptUnit x1 = null, x2 = null, y = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- IJavaScriptProject p1 = createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- p1.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE);
- this.problemRequestor = new ProblemRequestor();
- x1 = getWorkingCopy(
- "/P1/src/p/X1.js",
- "package p;\n" +
- "public class X1 {\n" +
- " void foo() {\n" +
- " }\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- x2 = getWorkingCopy(
- "/P1/src/p/X2.js",
- "package p;\n" +
- "public class X2 extends X1 {\n" +
- " void bar() {\n" +
- " }\n" +
- "}", owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject("P2", new String[] {"src"},
- new String[] {"JCL_LIB"});
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0, classpath = new IIncludePathEntry[length+1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "-p/X1");
- p2.setRawIncludepath(classpath, null);
- String src =
- "package p;\n" +
- "public class Y extends X2 {\n" +
- " void foobar() {\n" +
- " foo(); // accesses X1.foo, should trigger an error\n" +
- " bar(); // accesses X2.bar, OK\n" +
- " }\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- y = getWorkingCopy(
- "/P2/src/p/Y.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " foo(); // accesses X1.foo, should trigger an error\n" +
- " ^^^^^\n" +
- "Access restriction: The method foo() from the type X1 is not accessible due to restriction on required project P1\n" +
- "----------\n"
- );
- } finally {
- if (x1 != null)
- x1.discardWorkingCopy();
- if (x2 != null)
- x2.discardWorkingCopy();
- if (y != null)
- y.discardWorkingCopy();
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-/*
- * Missing access restriction violation error on generic type.
- * Field case.
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=122995
- */
-public void test009() throws CoreException {
- IJavaScriptUnit x1 = null, x2 = null, y = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- IJavaScriptProject p1 = createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- p1.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE);
- this.problemRequestor = new ProblemRequestor();
- x1 = getWorkingCopy(
- "/P1/src/p/X1.js",
- "package p;\n" +
- "public class X1 {\n" +
- " int m1;\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- x2 = getWorkingCopy(
- "/P1/src/p/X2.js",
- "package p;\n" +
- "public class X2 extends X1 {\n" +
- " char m2;\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject("P2", new String[] {"src"},
- new String[] {"JCL_LIB"});
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0, classpath = new IIncludePathEntry[length+1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "-p/X1");
- p2.setRawIncludepath(classpath, null);
- String src =
- "package p;\n" +
- "public class Y extends X2 {\n" +
- " void foobar() {\n" +
- " int l1 = m1; // accesses X1.m1, should trigger an error\n" +
- " char l2 = m2; // accesses X2.m2, OK\n" +
- " }\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- y = getWorkingCopy(
- "/P2/src/p/Y.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/p/Y.java (at line 4)\n" +
- " int l1 = m1; // accesses X1.m1, should trigger an error\n" +
- " ^^\n" +
- "Access restriction: The field m1 from the type X1 is not accessible due to restriction on required project P1\n" +
- "----------\n"
- );
- } finally {
- if (x1 != null)
- x1.discardWorkingCopy();
- if (x2 != null)
- x2.discardWorkingCopy();
- if (y != null)
- y.discardWorkingCopy();
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-/*
- * Missing access restriction violation error on generic type.
- * Inner type case.
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=122995
- */
-public void test010() throws CoreException {
- IJavaScriptUnit x1 = null, x2 = null, y = null;
- try {
- WorkingCopyOwner owner = new WorkingCopyOwner(){};
- IJavaScriptProject p1 = createJavaProject(
- "P1",
- new String[] {"src"},
- new String[] {"JCL_LIB"});
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p1.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- p1.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE);
- this.problemRequestor = new ProblemRequestor();
- x1 = getWorkingCopy(
- "/P1/src/p/X1.js",
- "package p;\n" +
- "public class X1 {\n" +
- " class C1 {\n" +
- " protected C1 (int dummy) {}\n" +
- " protected void foo() {}\n" +
- " }\n" +
- " interface I1 {}\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- x2 = getWorkingCopy(
- "/P1/src/p/X2.js",
- "package p;\n" +
- "public class X2 extends X1 {\n" +
- " class C2 {}\n" +
- " interface I2 {}\n" +
- "}",
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n"
- );
- IJavaScriptProject p2 = createJavaProject("P2", new String[] {"src"},
- new String[] {"JCL_LIB"});
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.compliance", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.source", "1.5");
- p2.setOption("org.eclipse.wst.jsdt.core.compiler.targetPlatform", "1.5");
- p2.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE);
- IIncludePathEntry[] classpath = p2.getRawIncludepath();
- int length = classpath.length;
- System.arraycopy(classpath, 0, classpath = new IIncludePathEntry[length+1], 0, length);
- classpath[length] = createSourceEntry("P2", "/P1", "-p/X1");
- p2.setRawIncludepath(classpath, null);
- String src =
- "package p;\n" +
- "public class Y extends X2 {\n" +
- " class C3a extends C1 { // error\n" +
- " C3a() {\n" +
- " super(0);\n" +
- " foo(); // error\n" +
- " }\n" +
- " }\n" +
- " class C3c extends C2 implements I2 {}\n" +
- " void foobar() {\n" +
- " C1 m1 = // error\n" +
- " new C1(0); // error\n" +
- " C2 m2 = new C2();\n" +
- " }\n" +
- "}";
- this.problemRequestor = new ProblemRequestor(src);
- y = getWorkingCopy(
- "/P2/src/p/Y.js",
- src,
- owner,
- this.problemRequestor);
- assertProblems(
- "Unexpected problems value",
- "----------\n" +
- "1. ERROR in /P2/src/p/Y.java (at line 3)\n" +
- " class C3a extends C1 { // error\n" +
- " ^^\n" +
- "Access restriction: The type X1.C1 is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "2. ERROR in /P2/src/p/Y.java (at line 5)\n" +
- " super(0);\n" +
- " ^^^^^^^^^\n" +
- "Access restriction: The constructor X1.C1(int) is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "3. ERROR in /P2/src/p/Y.java (at line 6)\n" +
- " foo(); // error\n" +
- " ^^^^^\n" +
- "Access restriction: The method foo() from the type X1.C1 is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "4. ERROR in /P2/src/p/Y.java (at line 11)\n" +
- " C1 m1 = // error\n" +
- " ^^\n" +
- "Access restriction: The type X1.C1 is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "5. ERROR in /P2/src/p/Y.java (at line 12)\n" +
- " new C1(0); // error\n" +
- " ^^^^^^^^^\n" +
- "Access restriction: The constructor X1.C1(int) is not accessible due to restriction on required project P1\n" +
- "----------\n" +
- "6. ERROR in /P2/src/p/Y.java (at line 12)\n" +
- " new C1(0); // error\n" +
- " ^^\n" +
- "Access restriction: The type X1.C1 is not accessible due to restriction on required project P1\n" +
- "----------\n"
- );
- } finally {
- if (x1 != null)
- x1.discardWorkingCopy();
- if (x2 != null)
- x2.discardWorkingCopy();
- if (y != null)
- y.discardWorkingCopy();
- deleteProjects(new String[] {"P1", "P2"});
- }
-}
-
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachSourceTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachSourceTests.java
deleted file mode 100644
index dec120e..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachSourceTests.java
+++ /dev/null
@@ -1,1141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import java.io.IOException;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.jsdt.core.IClassFile;
-import org.eclipse.wst.jsdt.core.IFunction;
-import org.eclipse.wst.jsdt.core.IJavaScriptElement;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IMember;
-import org.eclipse.wst.jsdt.core.IPackageFragment;
-import org.eclipse.wst.jsdt.core.IPackageFragmentRoot;
-import org.eclipse.wst.jsdt.core.ISourceRange;
-import org.eclipse.wst.jsdt.core.IType;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTParser;
-
-/**
- * TO DO:
- * - source attachment on external jar.
- * - don't use assertTrue where assertEquals should be used
- * - don't hardcode positions
-*/
-public class AttachSourceTests extends ModifyingResourceTests {
- static {
-// TESTS_NAMES = new String[] { "testClassFileGetElementAt04" };
-// TESTS_NUMBERS = new int[] { 5 };
-// TESTS_RANGE = new int[] { 169, 180 };
- }
-
- public static Test suite() {
- return buildModelTestSuite(AttachSourceTests.class);
- }
-
- /** @deprecated using deprecated code */
- private static final int AST_INTERNAL_JLS2 = AST.JLS2;
-
- private IPackageFragmentRoot pkgFragmentRoot;
- private IType genericType;
- private IPackageFragment innerClasses;
-
-public AttachSourceTests(String name) {
- super(name);
-}
-public ASTNode runConversion(IClassFile classFile, boolean resolveBindings) {
- ASTParser parser = ASTParser.newParser(AST_INTERNAL_JLS2);
- parser.setSource(classFile);
- parser.setResolveBindings(resolveBindings);
- parser.setWorkingCopyOwner(null);
- return parser.createAST(null);
-}
-protected void setUp() throws Exception {
- super.setUp();
- this.attachSource(this.pkgFragmentRoot, "/AttachSourceTests/attachsrc.zip", "");
-}
-/**
- * Create project and set the jar placeholder.
- */
-public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- setUpJavaProject("AttachSourceTests");
- addLibraryEntry("/AttachSourceTests/b153133.jar", false);
- this.pkgFragmentRoot = this.currentProject.getPackageFragmentRoot(this.getFile("/AttachSourceTests/attach.jar"));
- setUpGenericJar();
- setUpInnerClassesJar();
-}
-private void setUpGenericJar() throws IOException, CoreException {
- String[] pathAndContents = new String[] {
- "generic/X.js",
- "package generic;\n" +
- "public class X {\n" +
- " void foo(X x) {\n" +
- " }\n" +
- " V foo(K key, V value) {\n" +
- " return value;\n" +
- " }\n" +
- " void foo(int i, X x) {\n" +
- " }\n" +
- " void foo(boolean b, X extends X> x) {\n" +
- " }\n" +
- " void foo(float f, X> x) {\n" +
- " }\n" +
- " void foo(Y extends Integer, ? extends Object> y) {\n" +
- " }\n" +
- " void foo(Z.Inner inner) {\n" +
- " }\n" +
- " void foo(AType t) {\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- "}\n" +
- "class Z {\n" +
- " class Inner {\n" +
- " }\n" +
- "}\n" +
- "class AType {\n" + // type name containing character 'T'
- "}"
- };
- addLibrary("generic.jar", "genericsrc.zip", pathAndContents, JavaScriptCore.VERSION_1_5);
- IFile jar = getFile("/AttachSourceTests/generic.jar");
- this.genericType = this.currentProject.getPackageFragmentRoot(jar).getPackageFragment("generic").getClassFile("X.class").getType();
-}
-private void setUpInnerClassesJar() throws IOException, CoreException {
- String[] pathAndContents = new String[] {
- "inner/X.js",
- "package inner;\n" +
- "public class X {\n" +
- " void foo() {\n" +
- " new X() {};\n" +
- " class Y {}\n" +
- " new Y() {\n" +
- " class Z {}\n" +
- " };\n" +
- " class W {\n" +
- " void bar() {\n" +
- " new W() {};\n" +
- " }\n" +
- " }\n" +
- " new Object() {\n" +
- " class U {\n" +
- " U(String s) {\n" +
- " }\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " class V {\n" +
- " V(String s) {\n" +
- " }\n" +
- " }\n" +
- "}"
- };
- addLibrary("innerClasses.jar", "innerClassessrc.zip", pathAndContents, JavaScriptCore.VERSION_1_4);
- IFile jar = getFile("/AttachSourceTests/innerClasses.jar");
- this.innerClasses = this.currentProject.getPackageFragmentRoot(jar).getPackageFragment("inner");
-}
-protected void tearDown() throws Exception {
- IPackageFragmentRoot[] roots = this.currentProject.getAllPackageFragmentRoots();
- for (int i = 0; i < roots.length; i++) {
- IPackageFragmentRoot root = roots[i];
- if (this.genericType != null && root.equals(this.genericType.getPackageFragment().getParent())) continue;
- if (this.innerClasses != null && root.equals(this.innerClasses.getParent())) continue;
- if (root.getKind() == IPackageFragmentRoot.K_BINARY) {
- this.attachSource(root, null, null); // detach source
- }
- }
- super.tearDown();
-}
-
-/**
- * Reset the jar placeholder and delete project.
- */
-public void tearDownSuite() throws Exception {
- deleteProject(this.currentProject);
- super.tearDownSuite();
-}
-
-/**
- * Test AST.parseCompilationUnit(IClassFile, boolean).
- */
-public void testASTParsing() throws JavaScriptModelException {
- this.attachSource(this.pkgFragmentRoot, "/AttachSourceTests/attachsrc.zip", "");
- IClassFile classFile = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- ASTNode node = runConversion(classFile, true);
- assertNotNull("No node", node);
- this.attachSource(this.pkgFragmentRoot, null, null);
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertTrue("source code should no longer exist for A", cf.getSource() == null);
- try {
- node = runConversion(classFile, true);
- assertTrue("Should not be here", false);
- } catch(IllegalStateException e) {
- assertTrue(true);
- }
-}
-/**
- * Test AST.parseCompilationUnit(IClassFile, boolean).
- * Test for http://bugs.eclipse.org/bugs/show_bug.cgi?id=30471
- */
-public void testASTParsing2() throws JavaScriptModelException {
- this.attachSource(this.pkgFragmentRoot, "/AttachSourceTests/attachsrc.zip", "");
- IClassFile classFile = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- ASTNode node = runConversion(classFile, false);
- assertNotNull("No node", node);
- this.attachSource(this.pkgFragmentRoot, null, null);
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertTrue("source code should no longer exist for A", cf.getSource() == null);
- try {
- node = runConversion(classFile, false);
- assertTrue("Should not be here", false);
- } catch(IllegalStateException e) {
- assertTrue(true);
- }
-}
-/**
- * Changing the source attachment file should update the java model.
- * (regression test for bug 23292 Must restart Eclipse after debug of source in .zip is updated)
- */
-public void testChangeSourceAttachmentFile() throws CoreException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- IFunction method = cf.getType().getFunction("foo", new String[] {});
-
- // check initial source
- assertSourceEquals(
- "unexpected initial source for foo()",
- "public void foo() {\n" +
- " }",
- method.getSource());
-
- // replace source attachment file
- this.swapFiles("AttachSourceTests/attachsrc.zip", "AttachSourceTests/attachsrc.new.zip");
- assertSourceEquals(
- "unexpected source for foo() after replacement",
- "public void foo() {\n" +
- " System.out.println(\"foo\");\n" +
- " }",
- method.getSource());
-
- // delete source attachment file
- this.deleteFile("AttachSourceTests/attachsrc.zip");
- assertSourceEquals(
- "unexpected source for foo() after deletion",
- null,
- method.getSource());
-
- // add source attachment file back
- this.moveFile("AttachSourceTests/attachsrc.new.zip", "AttachSourceTests/attachsrc.zip");
- assertSourceEquals(
- "unexpected source for foo() after addition",
- "public void foo() {\n" +
- " }",
- method.getSource());
-}
-/**
- * Ensure that a class file with an attached source can retrieve its children given a source index.
- */
-public void testClassFileGetElementAt01() throws JavaScriptModelException {
- IClassFile classFile = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- String source = classFile.getSource();
- IJavaScriptElement element = classFile.getElementAt(source.indexOf("class A"));
- assertElementEquals(
- "Unexpected element",
- "A [in A.class [in x.y [in attach.jar [in AttachSourceTests]]]]",
- element);
-}
-/**
- * Ensure that a class file with an attached source can retrieve its children given a source index.
- */
-public void testClassFileGetElementAt02() throws JavaScriptModelException {
- IClassFile classFile = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- String source = classFile.getSource();
- IJavaScriptElement element = classFile.getElementAt(source.indexOf("public A"));
- assertElementEquals(
- "Unexpected element",
- "A() [in A [in A.class [in x.y [in attach.jar [in AttachSourceTests]]]]]",
- element);
-}
-/**
- * Ensure that a class file with an attached source can retrieve its children given a source index.
- */
-public void testClassFileGetElementAt03() throws JavaScriptModelException {
- IClassFile classFile = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- String source = classFile.getSource();
- IJavaScriptElement element = classFile.getElementAt(source.indexOf("void foo"));
- assertElementEquals(
- "Unexpected element",
- "foo() [in A [in A.class [in x.y [in attach.jar [in AttachSourceTests]]]]]",
- element);
-}
-/*
- * Ensure that a constructor of a binary member type can be retrieved with its source position.
- * (regression test for bug 119249 codeResolve, search, etc. don't work on constructor of binary inner class)
- */
-public void testClassFileGetElementAt04() throws JavaScriptModelException {
- IClassFile classFile = this.innerClasses.getClassFile("X$V.class");
- String source = classFile.getSource();
- IJavaScriptElement element = classFile.getElementAt(source.indexOf("V(String s)"));
- assertElementEquals(
- "Unexpected element",
- "V(inner.X, java.lang.String) [in V [in X$V.class [in inner [in innerClasses.jar [in AttachSourceTests]]]]]",
- element);
-}/*
- * Ensures that the source of a .class file is implicetely attached when prj=src=bin
- * (regression test for bug 41444 [navigation] error dialog on opening class file)
- */
-public void testClassFileInOutput() throws CoreException {
- IClassFile classFile = getClassFile("AttachSourceTests/src/A.class");
- String source = classFile.getSource();
- assertSourceEquals(
- "Unexpected source",
- "public class A {\n" +
- "}",
- source);
-}
-/**
- * Retrieves the source code for "A.class", which is
- * the entire CU for "A.js".
- */
-public void testClassRetrieval() throws JavaScriptModelException {
- IClassFile objectCF = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertTrue("source code does not exist for the entire attached compilation unit", objectCF.getSource() != null);
-}
-/**
- * Removes the source attachment from the jar.
- */
-public void testDetachSource() throws JavaScriptModelException {
- this.attachSource(this.pkgFragmentRoot, null, null);
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertTrue("source code should no longer exist for A", cf.getSource() == null);
- assertTrue("name range should no longer exist for A", cf.getType().getNameRange().getOffset() == -1);
- assertTrue("source range should no longer exist for A", cf.getType().getSourceRange().getOffset() == -1);
- assertTrue("Source attachment path should be null", null == this.pkgFragmentRoot.getSourceAttachmentPath());
- assertTrue("Source attachment root path should be null", null ==this.pkgFragmentRoot.getSourceAttachmentRootPath());
-}
-/*
- * Ensures that the source of a generic method can be retrieved.
- */
-public void testGeneric1() throws JavaScriptModelException {
- IFunction method = this.genericType.getFunction("foo", new String[] {"QX;"});
- assertSourceEquals(
- "Unexpected source",
- "void foo(X x) {\n" +
- " }",
- method.getSource());
-}
-/*
- * Ensures that the source of a generic method can be retrieved.
- */
-public void testGeneric2() throws JavaScriptModelException {
- IFunction method = this.genericType.getFunction("foo", new String[] {"QK;", "QV;"});
- assertSourceEquals(
- "Unexpected source",
- " V foo(K key, V value) {\n" +
- " return value;\n" +
- " }",
- method.getSource());
-}
-/*
- * Ensures that the source of a generic method can be retrieved.
- * (regression test for bug 129317 Outline view inconsistent with code
- */
-public void testGeneric3() throws JavaScriptModelException {
- IFunction method = this.genericType.getFunction("foo", new String[] {"I", "Lgeneric.X<[Ljava.lang.Object;>;"});
- assertSourceEquals(
- "Unexpected source",
- "void foo(int i, X x) {\n" +
- " }",
- method.getSource());
-}
-public void testGeneric4() throws JavaScriptModelException {
- IFunction method = this.genericType.getFunction("foo", new String[] {"Z", "Lgeneric.X<+Lgeneric.X;>;"});
- assertSourceEquals(
- "Unexpected source",
- "void foo(boolean b, X extends X> x) {\n" +
- " }",
- method.getSource());
-}
-public void testGeneric5() throws JavaScriptModelException {
- IFunction method = this.genericType.getFunction("foo", new String[] {"F", "Lgeneric.X<*>;"});
- assertSourceEquals(
- "Unexpected source",
- "void foo(float f, X> x) {\n" +
- " }",
- method.getSource());
-}
-public void testGeneric6() throws JavaScriptModelException {
- IFunction method = this.genericType.getFunction("foo", new String[] {"Lgeneric.Y<+Ljava.lang.Integer;+Ljava.lang.Object;>;"});
- assertSourceEquals(
- "Unexpected source",
- "void foo(Y extends Integer, ? extends Object> y) {\n" +
- " }",
- method.getSource());
-}
-public void testGeneric7() throws JavaScriptModelException {
- IFunction method = this.genericType.getFunction("foo", new String[] {"Lgeneric.Z.Inner;"});
- assertSourceEquals(
- "Unexpected source",
- "void foo(Z.Inner inner) {\n" +
- " }",
- method.getSource());
-}
-public void testGeneric8() throws JavaScriptModelException {
- IFunction method = this.genericType.getFunction("foo", new String[] {"Lgeneric.AType;"});
- assertSourceEquals(
- "Unexpected source",
- "void foo(AType t) {\n" +
- " }",
- method.getSource());
-}
-/**
- * Ensures that name ranges exists for BinaryMembers that have
- * mapped source.
- */
-public void testGetNameRange01() throws JavaScriptModelException {
- IClassFile classFile = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- IFunction method = classFile.getType().getFunction("foo", null);
- assertSourceEquals("Unexpected name source", "foo", getNameSource(classFile.getSource(), method));
-}
-/**
- * Ensures that name ranges exists for BinaryMembers that have
- * mapped source.
- */
-public void testGetNameRange02() throws JavaScriptModelException {
- IClassFile classFile = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- assertSourceEquals("Unexpected name source", "A", getNameSource(classFile.getSource(), classFile.getType()));
-}
-/*
- * Ensure that the name range for a constructor of a binary member type is correct.
- * (regression test for bug 119249 codeResolve, search, etc. don't work on constructor of binary inner class)
- */
-public void testGetNameRange03() throws JavaScriptModelException {
- IClassFile classFile = this.innerClasses.getClassFile("X$V.class");
- IFunction constructor = classFile.getType().getFunction("V", new String[] {"Linner.X;", "Ljava.lang.String;"});
- assertSourceEquals("Unexpected name source", "V", getNameSource(classFile.getSource(), constructor));
-}
-/**
- * Retrieves the source attachment paths for jar root.
- */
-public void testGetSourceAttachmentPath() throws JavaScriptModelException {
- IPath saPath= this.pkgFragmentRoot.getSourceAttachmentPath();
- assertEquals("Source attachment path not correct for root " + this.pkgFragmentRoot, "/AttachSourceTests/attachsrc.zip", saPath.toString());
- assertEquals("Source attachment root path should be empty", new Path(""), this.pkgFragmentRoot.getSourceAttachmentRootPath());
-}
-/**
- * Ensures that a source range exists for the class file that has
- * mapped source.
- */
-public void testGetSourceRange() throws JavaScriptModelException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- ISourceRange sourceRange = cf.getSourceRange();
- assertTrue("Class file should have associated source range", sourceRange != null);
- assertEquals("Unexpected offset", 0, sourceRange.getOffset());
- assertEquals("Unexpected length", 100, sourceRange.getLength());
-}
-/**
- * Ensures that a source range exists for the (inner) class file that has
- * mapped source.
- */
-public void testGetSourceRangeInnerClass() throws JavaScriptModelException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A$Inner.class");
- ISourceRange sourceRange = cf.getSourceRange();
- assertTrue("Inner class file should have associated source range", sourceRange != null);
- assertEquals("Unexpected offset", 0, sourceRange.getOffset());
- assertEquals("Unexpected length", 100, sourceRange.getLength());
-}
-/*
- * Ensures that the source of an inner class can be retrieved.
- */
-public void testInnerClass1() throws JavaScriptModelException {
- IType type = this.innerClasses.getClassFile("X.class").getType();
- assertSourceEquals(
- "Unexpected source",
- "public class X {\n" +
- " void foo() {\n" +
- " new X() {};\n" +
- " class Y {}\n" +
- " new Y() {\n" +
- " class Z {}\n" +
- " };\n" +
- " class W {\n" +
- " void bar() {\n" +
- " new W() {};\n" +
- " }\n" +
- " }\n" +
- " new Object() {\n" +
- " class U {\n" +
- " U(String s) {\n" +
- " }\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " class V {\n" +
- " V(String s) {\n" +
- " }\n" +
- " }\n" +
- "}",
- type.getSource());
-}
-/*
- * Ensures that the source of an inner class can be retrieved.
- */
-public void testInnerClass2() throws JavaScriptModelException {
- IType type = this.innerClasses.getClassFile("X$1.class").getType();
- assertSourceEquals(
- "Unexpected source",
- "X() {}",
- type.getSource());
-}
-/*
- * Ensures that the source of an inner class can be retrieved.
- */
-public void testInnerClass3() throws JavaScriptModelException {
- IType type = this.innerClasses.getClassFile("X$2.class").getType();
- assertSourceEquals(
- "Unexpected source",
- "Y() {\n" +
- " class Z {}\n" +
- " }",
- type.getSource());
-}
-/*
- * Ensures that the source of an inner class can be retrieved.
- */
-public void testInnerClass4() throws JavaScriptModelException {
- IType type = this.innerClasses.getClassFile("X$3.class").getType();
- assertSourceEquals(
- "Unexpected source",
- "W() {}",
- type.getSource());
-}
-/*
- * Ensures that the source of an inner class can be retrieved.
- */
-public void testInnerClass5() throws JavaScriptModelException {
- IType type = this.innerClasses.getClassFile("X$1$Y.class").getType();
- assertSourceEquals(
- "Unexpected source",
- "class Y {}",
- type.getSource());
-}
-/*
- * Ensures that the source of an inner class can be retrieved.
- */
-public void testInnerClass6() throws JavaScriptModelException {
- IType type = this.innerClasses.getClassFile("X$1$W.class").getType();
- assertSourceEquals(
- "Unexpected source",
- "class W {\n" +
- " void bar() {\n" +
- " new W() {};\n" +
- " }\n" +
- " }",
- type.getSource());
-}
-/*
- * Ensures that the source of an inner class can be retrieved.
- */
-public void testInnerClass7() throws JavaScriptModelException {
- IType type = this.innerClasses.getClassFile("X$2$Z.class").getType();
- assertSourceEquals(
- "Unexpected source",
- "class Z {}",
- type.getSource());
-}
-/*
- * Ensures that the source of an inner class can be retrieved.
- */
-public void testInnerClass8() throws JavaScriptModelException {
- IType type = this.innerClasses.getClassFile("X$V.class").getType();
- assertSourceEquals(
- "Unexpected source",
- "class V {\n" +
- " V(String s) {\n" +
- " }\n" +
- " }",
- type.getSource());
-}
-/*
- * Ensures that the source of an inner class can be retrieved.
- * (regression test for bug 124611 IAE in Signature.createCharArrayTypeSignature)
- */
-public void testInnerClass9() throws JavaScriptModelException {
- IType type = this.innerClasses.getClassFile("X$4$U.class").getType();
- assertSourceEquals(
- "Unexpected source",
- "class U {\n" +
- " U(String s) {\n" +
- " }\n" +
- " }",
- type.getSource());
-}
-
-/**
- * Ensures that a source folder can be attached to a lib folder.
- */
-public void testLibFolder() throws JavaScriptModelException {
- IPackageFragmentRoot root = this.getPackageFragmentRoot("/AttachSourceTests/lib");
- this.attachSource(root, "/AttachSourceTests/srcLib", "");
-
- IClassFile cf = root.getPackageFragment("p").getClassFile("X.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p;\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " }\n" +
- "}",
- cf.getSource());
-}
-/**
- * Retrieves the source code for methods of class A.
- */
-public void testMethodRetrieval() throws JavaScriptModelException {
- IClassFile cf = this.pkgFragmentRoot.getPackageFragment("x.y").getClassFile("A.class");
- IFunction[] methods = cf.getType().getFunctions();
- for (int i = 0; i < methods.length; i++) {
- IFunction method = methods[i];
- assertTrue("source code does not exist for the method " + method, method.getSource() != null);
- assertTrue("method name range not correct", method.getNameRange().getOffset() != -1 && method.getNameRange().getLength() != 0);
- }
-}
-/**
- * Closes the jar, to ensure when it is re-opened the source
- * attachment still exists.
- */
-public void testPersistence() throws JavaScriptModelException {
- this.pkgFragmentRoot.close();
- testClassRetrieval();
- testMethodRetrieval();
-}
-
-/*
- * Ensures that having a project as a class folder and attaching its sources finds the source
- * of a class in a non-default package.
- * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=65186)
- */
-public void testProjectAsClassFolder1() throws CoreException {
- try {
- createJavaProject("P1");
- createFolder("/P1/p");
- createFile(
- "/P1/p/X.js",
- "package p;\n" +
- "public class X {\n" +
- "}"
- );
- IProject p1 = getProject("P1");
- p1.build(IncrementalProjectBuilder.FULL_BUILD, null);
- IJavaScriptProject javaProject = createJavaProject("P2", new String[]{""}, new String[]{"/P1"});
- IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(p1);
- attachSource(root, "/P1", null);
- IClassFile cf = root.getPackageFragment("p").getClassFile("X.class");
- assertSourceEquals(
- "Unexpected source for class file P1/p/X.class",
- "package p;\n" +
- "public class X {\n" +
- "}",
- cf.getSource());
- } finally {
- deleteProject("P1");
- deleteProject("P2");
- }
-}
-
-/*
- * Ensures that having a project as a class folder and attaching its sources finds the source
- * of a class in the default package.
- * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=65186)
- */
-public void testProjectAsClassFolder2() throws CoreException {
- try {
- createJavaProject("P1");
- createFile(
- "/P1/X.js",
- "public class X {\n" +
- "}"
- );
- IProject p1 = getProject("P1");
- p1.build(IncrementalProjectBuilder.FULL_BUILD, null);
- IJavaScriptProject javaProject = createJavaProject("P2", new String[]{""}, new String[]{"/P1"});
- IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(p1);
- attachSource(root, "/P1", null);
- IClassFile cf = root.getPackageFragment("").getClassFile("X.class");
- assertSourceEquals(
- "Unexpected source for class file P1/X.class",
- "public class X {\n" +
- "}",
- cf.getSource());
- } finally {
- deleteProject("P1");
- deleteProject("P2");
- }
-}
-
-/*
- * Ensures that having a project as source attachement finds the source
- * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=65186)
- */
-public void testProjectAsSourceAttachment() throws CoreException {
- try {
- IJavaScriptProject javaProject = createJavaProject("Test", new String[]{""}, new String[]{"/AttachSourceTests/test.jar"});
- createFolder("/Test/test1");
- createFile("/Test/test1/Test.js",
- "package test1;\n" +
- "\n" +
- "public class Test {}");
- IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(getFile("/AttachSourceTests/test.jar"));
- attachSource(root, "/Test", null);
- IClassFile cf = root.getPackageFragment("test1").getClassFile("Test.class");
- assertSourceEquals(
- "Unexpected source for class file test1/Test.class",
- "package test1;\n" +
- "\n" +
- "public class Test {}",
- cf.getSource());
- } finally {
- deleteProject("Test");
- }
-}
-
-///**
-// * Attaches a source zip to a jar. The source zip has
-// * a nested root structure and exists as a resource. Tests that
-// * the attachment is persisted as a server property for the jar.
-// */
-//public void testRootPath() throws JavaScriptModelException {
-// IJavaScriptProject project = getJavaProject("AttachSourceTests");
-// IFile jar = (IFile) project.getProject().findMember("attach2.jar");
-// IFile srcZip=(IFile) project.getProject().findMember("attach2src.zip");
-// JarPackageFragmentRoot root = (JarPackageFragmentRoot) project.getPackageFragmentRoot(jar);
-// root.attachSource(srcZip.getFullPath(), new Path("src/nested"), null);
-//
-// IClassFile cf = root.getPackageFragment("x.y").getClassFile("B.class");
-// assertTrue("source code does not exist for the entire attached compilation unit", cf.getSource() != null);
-// root.close();
-// cf = root.getPackageFragment("x.y").getClassFile("B.class");
-// assertTrue("source code does not exist for the entire attached compilation unit", cf.getSource() != null);
-//
-// IPath rootSAPath= root.getSourceAttachmentRootPath();
-// assertEquals("Unexpected source attachment root path for " + root.getPath(), "src/nested", rootSAPath.toString());
-//
-// IPath saPath= root.getSourceAttachmentPath();
-// assertEquals("Unexpected source attachment path for " + root.getPath(), "/AttachSourceTests/attach2src.zip", saPath.toString());
-//
-// root.close();
-//}
-///**
-// * Attaches a source zip to a jar specifying an invalid root path.
-// * Ensures that the root path is just used as a hint, and that the source is still retrieved.
-// */
-//public void testRootPath2() throws JavaScriptModelException {
-// IJavaScriptProject project = getJavaProject("AttachSourceTests");
-// IFile jar = (IFile) project.getProject().findMember("attach2.jar");
-// IFile srcZip=(IFile) project.getProject().findMember("attach2src.zip");
-// JarPackageFragmentRoot root = (JarPackageFragmentRoot) project.getPackageFragmentRoot(jar);
-// root.attachSource(srcZip.getFullPath(), new Path(""), null);
-//
-// IClassFile cf = root.getPackageFragment("x.y").getClassFile("B.class");
-// assertTrue("source code does not exist for the entire attached compilation unit", cf.getSource() != null);
-// root.close();
-//}
-///**
-// * Attaches a sa source folder can be attached to a lib folder specifying an invalid root path.
-// * Ensures that the root path is just used as a hint, and that the source is still retrieved.
-// */
-//public void testRootPath3() throws JavaScriptModelException {
-// IPackageFragmentRoot root = this.getPackageFragmentRoot("/AttachSourceTests/lib");
-// this.attachSource(root, "/AttachSourceTests/srcLib", "invalid");
-//
-// IClassFile cf = root.getPackageFragment("p").getClassFile("X.class");
-// assertSourceEquals(
-// "Unexpected source for class file",
-// "package p;\n" +
-// "public class X {\n" +
-// " public void foo() {\n" +
-// " }\n" +
-// "}",
-// cf.getSource());
-// root.close();
-//}
-/**
- * Attach a jar with a source attachement that doesn't contain the source folders
- */
-public void testRootPath4() throws JavaScriptModelException {
- IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test.jar"));
- this.attachSource(root, "/AttachSourceTests/src.zip", "invalid");
-
- IClassFile cf = root.getPackageFragment("test1").getClassFile("Test.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package test1;\n" +
- "\n" +
- "public class Test {}",
- cf.getSource());
- root.close();
-}
-/**
- * Attach a jar with a source attachement that doesn't contain the source folders
- */
-public void testRootPath5() throws JavaScriptModelException {
- IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/update.jar"));
- this.attachSource(root, "/AttachSourceTests/src.zip", "invalid");
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that doesn't contain the source folders
- */
-public void testRootPath6() throws JavaScriptModelException {
- IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/update.jar"));
- this.attachSource(root, "/AttachSourceTests/src.zip", null);
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that doesn't contain the source folders
- */
-public void testRootPath7() throws JavaScriptModelException {
- IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/full.jar"));
- this.attachSource(root, "/AttachSourceTests/src.zip", null);
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- cf = root.getPackageFragment("test1").getClassFile("Test.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package test1;\n" +
- "\n" +
- "public class Test {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that contains the source folders
- */
-public void testRootPath8() throws JavaScriptModelException {
- IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/full.jar"));
- this.attachSource(root, "/AttachSourceTests/fullsrc.zip", null);
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- cf = root.getPackageFragment("test1").getClassFile("Test.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package test1;\n" +
- "\n" +
- "public class Test {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that contains the source folders
- */
-public void testRootPath9() throws JavaScriptModelException {
- IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/full.jar"));
- this.attachSource(root, "/AttachSourceTests/fullsrc.zip", "invalid");
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("A.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "\n" +
- "public class A {}",
- cf.getSource());
-
- cf = root.getPackageFragment("").getClassFile("B.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "public class B {}",
- cf.getSource());
-
- cf = root.getPackageFragment("test1").getClassFile("Test.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package test1;\n" +
- "\n" +
- "public class Test {}",
- cf.getSource());
-
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * Attach a jar with a source attachement that is itself
- */
-public void testRootPath10() throws JavaScriptModelException {
- IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test2.jar"));
- this.attachSource(root, "/AttachSourceTests/test2.jar", null);
-
- IClassFile cf = root.getPackageFragment("p").getClassFile("X.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p;\n" +
- "\n" +
- "public class X {\n" +
- "\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- "}",
- cf.getSource());
- this.attachSource(root, null, null); // detach source
- root.close();
-}
-///**
-// * http://bugs.eclipse.org/bugs/show_bug.cgi?id=35965
-// */
-//public void testRootPath11() throws JavaScriptModelException {
-// IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
-// IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test4.jar"));
-// this.attachSource(root, "/AttachSourceTests/test4_src.zip", null);
-//
-// IClassFile cf = root.getPackageFragment("P1").getClassFile("D.class");
-// assertSourceEquals(
-// "Unexpected source for class file P1.D",
-// "package P1;\n" +
-// "\n" +
-// "public class D {}",
-// cf.getSource());
-//
-// cf = root.getPackageFragment("P1.p2").getClassFile("A.class");
-// assertSourceEquals(
-// "Unexpected source for class file P1.p2.A",
-// "package P1.p2;\n" +
-// "\n" +
-// "public class A {}",
-// cf.getSource());
-//
-// assertTrue("Not a binary root", root.getKind() == IPackageFragmentRoot.K_BINARY);
-// assertEquals("wrong jdk level", ClassFileConstants.JDK1_2, Util.getJdkLevel(root.getResource()));
-// this.attachSource(root, null, null); // detach source
-// root.close();
-//}
-/**
- * Attach a jar with a source attachement that is itself. The jar contains 2 root paths for the same class file.
- * (regression test for bug 74014 prefix path for source attachements - automatic detection does not seem to work)
- */
-public void testRootPath12() throws JavaScriptModelException {
- IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test5.jar"));
- attachSource(root, "/AttachSourceTests/test5.jar", null);
-
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("X.class");
- assertSourceEquals(
- "Unexpected source for class file",
- "package p1.p2;\n" +
- "public class X {\n" +
- "}\n",
- cf.getSource());
- attachSource(root, null, null); // detach source
- root.close();
-}
-/**
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=110172"
- */
-public void testBug110172() throws JavaScriptModelException {
- IJavaScriptProject project = this.getJavaProject("/AttachSourceTests");
- IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test6.jar"));
- assertTrue("Root doesn't exist", root.exists());
- attachSource(root, "/AttachSourceTests/test6src.zip", null);
-
- try {
- // check the javadoc source range in a class file
- IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("X.class");
- assertNotNull(cf);
- final String source = cf.getSource();
- assertNotNull("No source", source);
- IJavaScriptElement[] children = cf.getChildren();
- assertEquals("Wrong number of children", 1, children.length);
- IJavaScriptElement element = children[0];
- assertTrue("Not a type", element instanceof IType);
- IType type = (IType) element;
- IJavaScriptElement[] members = type.getChildren();
- final int length = members.length;
- assertEquals("Wrong number", 9, length);
- for (int i = 0; i < length; i++) {
- element = members[i];
- assertTrue(element instanceof IMember);
- final ISourceRange javadocRange = ((IMember) element).getJSdocRange();
- final String elementName = element.getElementName();
- if ("f".equals(elementName)) {
- assertNotNull("No javadoc source range", javadocRange);
- final int start = javadocRange.getOffset();
- final int end = javadocRange.getLength() + start - 1;
- String javadocSource = source.substring(start, end);
- assertTrue("Wrong javadoc", javadocSource.indexOf("field f") != -1);
- } else if ("foo".equals(elementName)) {
- assertNotNull("No javadoc source range", javadocRange);
- final int start = javadocRange.getOffset();
- final int end = javadocRange.getLength() + start - 1;
- String javadocSource = source.substring(start, end);
- assertTrue("Wrong javadoc", javadocSource.indexOf("method foo") != -1);
- } else if ("A".equals(elementName)) {
- assertNotNull("No javadoc source range", javadocRange);
- final int start = javadocRange.getOffset();
- final int end = javadocRange.getLength() + start - 1;
- String javadocSource = source.substring(start, end);
- assertTrue("Wrong javadoc", javadocSource.indexOf("member type A") != -1);
- } else if ("X".equals(elementName)) {
- // need treatment for the two constructors
- assertTrue("Not an IFunction", element instanceof IFunction);
- IFunction method = (IFunction) element;
- switch(method.getNumberOfParameters()) {
- case 0 :
- assertNull("Has a javadoc source range", javadocRange);
- break;
- case 1:
- assertNotNull("No javadoc source range", javadocRange);
- final int start = javadocRange.getOffset();
- final int end = javadocRange.getLength() + start - 1;
- String javadocSource = source.substring(start, end);
- assertTrue("Wrong javadoc", javadocSource.indexOf("constructor") != -1);
- }
- } else if ("f3".equals(elementName)) {
- assertNotNull("No javadoc source range", javadocRange);
- final int start = javadocRange.getOffset();
- final int end = javadocRange.getLength() + start - 1;
- String javadocSource = source.substring(start, end);
- assertTrue("Wrong javadoc", javadocSource.indexOf("Real") != -1);
- } else if ("f2".equals(elementName)) {
- assertNull("Has a javadoc source range", javadocRange);
- } else if ("foo2".equals(elementName)) {
- assertNull("Has a javadoc source range", javadocRange);
- } else if ("B".equals(elementName)) {
- assertNull("Has a javadoc source range", javadocRange);
- }
- }
- } finally {
- attachSource(root, null, null); // detach source
- root.close();
- }
-}
-/**
- * @test bug 153133: [model] toggle breakpoint in constructor creates a class load breakpoint
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=153133"
- */
-public void testBug153133() throws JavaScriptModelException {
- IPackageFragmentRoot root = this.currentProject.getPackageFragmentRoot(this.getFile("/AttachSourceTests/b153133.jar"));
- assertTrue("Root doesn't exist", root.exists());
-
- try {
- // Get class file type from jar
- IClassFile cf = root.getPackageFragment("test").getClassFile("Test.class");
- assertNotNull(cf);
- final String source = cf.getSource();
- assertNotNull("No source", source);
- IJavaScriptElement[] children = cf.getChildren();
- assertEquals("Wrong number of children", 1, children.length);
- IJavaScriptElement element = children[0];
- assertTrue("Not a type", element instanceof IType);
- IType type = (IType) element;
- IJavaScriptElement[] members = type.getChildren();
- final int length = members.length;
- assertEquals("Wrong number", 7, length);
-
- // Need to get type members constructors
- for (int i = 0; i < length; i++) {
- assertTrue(members[i] instanceof IMember);
- if (((IMember)members[i]).getElementType() == IJavaScriptElement.TYPE) {
- IType typeMember = (IType) members[i];
- String typeName = typeMember.getElementName();
- IFunction[] methods = typeMember.getFunctions();
- assertEquals("Expected only one constructor defined in type "+typeName, 1, methods.length);
- // Verify that source range is valid
- assertTrue("Expected a constructor instead of a method in type "+typeName, methods[0].isConstructor());
- IFunction constructor = methods[0];
- ISourceRange sourceRange = constructor.getSourceRange();
- assertTrue("Constructor "+constructor.getElementName()+" has invalid offset: "+sourceRange, sourceRange.getOffset() >= 0);
- assertTrue("Constructor "+constructor.getElementName()+" has invalid length: "+sourceRange, sourceRange.getLength() > 0);
- }
- }
- } finally {
- removeLibraryEntry(new Path("/JavaSearchBugs/lib/b148215.jar"));
- root.close();
- }
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachedJavadocTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachedJavadocTests.java
deleted file mode 100644
index 549f6ca..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachedJavadocTests.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.Map;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.wst.jsdt.core.IClassFile;
-import org.eclipse.wst.jsdt.core.IIncludePathAttribute;
-import org.eclipse.wst.jsdt.core.IIncludePathEntry;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.IField;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IFunction;
-import org.eclipse.wst.jsdt.core.IPackageFragment;
-import org.eclipse.wst.jsdt.core.IPackageFragmentRoot;
-import org.eclipse.wst.jsdt.core.IType;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.WorkingCopyOwner;
-
-public class AttachedJavadocTests extends ModifyingResourceTests {
- static {
-// TESTS_NAMES = new String[] { "test010" };
-// TESTS_NUMBERS = new int[] { 20 };
-// TESTS_RANGE = new int[] { 169, 180 };
- }
-
- public static Test suite() {
- return buildModelTestSuite(AttachedJavadocTests.class);
- }
-
- private IJavaScriptProject project;
- private IPackageFragmentRoot root;
-
- public AttachedJavadocTests(String name) {
- super(name);
- }
-
- /**
- * Create project and set the jar placeholder.
- */
- public void setUpSuite() throws Exception {
- super.setUpSuite();
-
- this.project = setUpJavaProject("AttachedJavadocProject", "1.5"); //$NON-NLS-1$
- Map options = this.project.getOptions(true);
- options.put(JavaScriptCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "2000"); //$NON-NLS-1$
- this.project.setOptions(options);
- IIncludePathEntry[] entries = this.project.getRawIncludepath();
- IResource resource = this.project.getProject().findMember("/doc/"); //$NON-NLS-1$
- assertNotNull("doc folder cannot be null", resource); //$NON-NLS-1$
- URI locationURI = resource.getLocationURI();
- assertNotNull("doc folder cannot be null", locationURI); //$NON-NLS-1$
- URL docUrl = null;
- try {
- docUrl = locationURI.toURL();
- } catch (MalformedURLException e) {
- assertTrue("Should not happen", false); //$NON-NLS-1$
- } catch(IllegalArgumentException e) {
- assertTrue("Should not happen", false); //$NON-NLS-1$
- }
- IIncludePathAttribute attribute = JavaScriptCore.newIncludepathAttribute(IIncludePathAttribute.JSDOC_LOCATION_ATTRIBUTE_NAME, docUrl.toExternalForm());
- for (int i = 0, max = entries.length; i < max; i++) {
- final IIncludePathEntry entry = entries[i];
- if (entry.getEntryKind() == IIncludePathEntry.CPE_LIBRARY
- && entry.getContentKind() == IPackageFragmentRoot.K_BINARY
- && "/AttachedJavadocProject/lib/test6.jar".equals(entry.getPath().toString())) { //$NON-NLS-1$
- entries[i] = JavaScriptCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), new IIncludePathAttribute[] { attribute}, entry.isExported());
- }
- }
- project.setRawIncludepath(entries, null);
-
- IPackageFragmentRoot[] roots = this.project.getAllPackageFragmentRoots();
- int count = 0;
- for (int i = 0, max = roots.length; i < max; i++) {
- final IPackageFragmentRoot packageFragmentRoot = roots[i];
- switch(packageFragmentRoot.getKind()) {
- case IPackageFragmentRoot.K_BINARY :
- if (!packageFragmentRoot.isExternal()) {
- count++;
- if (root == null) {
- root = packageFragmentRoot;
- }
- }
- }
- }
- assertEquals("Wrong value", 1, count); //$NON-NLS-1$
- assertNotNull("Should not be null", root); //$NON-NLS-1$
- }
-
- /**
- * Reset the jar placeholder and delete project.
- */
- public void tearDownSuite() throws Exception {
- this.deleteProject("AttachedJavadocProject"); //$NON-NLS-1$
- this.root = null;
- this.project = null;
- super.tearDownSuite();
- }
-
- // test javadoc for a package fragment
- public void test001() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- String javadoc = packageFragment.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- }
-
- // for a class file
- public void test002() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- }
-
- // for a field
- public void test003() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IField field = type.getField("f"); //$NON-NLS-1$
- assertNotNull(field);
- String javadoc = field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- }
-
- // for a method
- public void test004() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IFunction method = type.getFunction("foo", new String[] {"I", "J", "Ljava.lang.String;"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue(method.exists());
- String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- String[] paramNames = method.getParameterNames();
- assertNotNull(paramNames);
- assertEquals("Wrong size", 3, paramNames.length); //$NON-NLS-1$
- assertEquals("Wrong name for first param", "i", paramNames[0]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong name for second param", "l", paramNames[1]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong name for third param", "s", paramNames[2]); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // for a constructor
- public void test005() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IFunction method = type.getFunction("X", new String[] {"I"}); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(method.exists());
- String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- String[] paramNames = method.getParameterNames();
- assertNotNull(paramNames);
- assertEquals("Wrong size", 1, paramNames.length); //$NON-NLS-1$
- assertEquals("Wrong name for first param", "i", paramNames[0]); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // for a member type
- public void test006() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X$A.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- }
-
- // for a constructor
- public void test007() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X$A.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IFunction method = type.getFunction("A", new String[] {"Lp1.p2.X;", "F"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertTrue(method.exists());
- String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- String[] paramNames = method.getParameterNames();
- assertNotNull(paramNames);
- assertEquals("Wrong size", 1, paramNames.length); //$NON-NLS-1$
- assertEquals("Wrong name for first param", "f", paramNames[0]); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // for a method foo2
- public void test008() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IFunction method = type.getFunction("foo2", new String[0]); //$NON-NLS-1$
- assertTrue(method.exists());
- String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- String[] paramNames = method.getParameterNames();
- assertNotNull(paramNames);
- assertEquals("Wrong size", 0, paramNames.length); //$NON-NLS-1$
- }
-
- // for a field f2
- public void test009() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IField field = type.getField("f2"); //$NON-NLS-1$
- assertNotNull(field);
- String javadoc = field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- }
-
- // test archive doc
- public void test010() throws JavaScriptModelException {
- IIncludePathEntry[] savedEntries = null;
- try {
- IIncludePathEntry[] entries = this.project.getRawIncludepath();
- savedEntries = (IIncludePathEntry[]) entries.clone();
- IResource resource = this.project.getProject().findMember("/doc.zip"); //$NON-NLS-1$
- assertNotNull("doc folder cannot be null", resource); //$NON-NLS-1$
- URI locationURI = resource.getLocationURI();
- assertNotNull("doc folder cannot be null", locationURI); //$NON-NLS-1$
- URL docUrl = null;
- try {
- docUrl = locationURI.toURL();
- } catch (MalformedURLException e) {
- assertTrue("Should not happen", false); //$NON-NLS-1$
- } catch(IllegalArgumentException e) {
- assertTrue("Should not happen", false); //$NON-NLS-1$
- }
- final String path = "jar:" + docUrl.toExternalForm() + "!/doc"; //$NON-NLS-1$ //$NON-NLS-2$
- //final String path = "jar:" + "platform:/resource/AttachedJavadocProject/doc.zip" + "!/doc";
- IIncludePathAttribute attribute = JavaScriptCore.newIncludepathAttribute(IIncludePathAttribute.JSDOC_LOCATION_ATTRIBUTE_NAME, path);
- for (int i = 0, max = entries.length; i < max; i++) {
- final IIncludePathEntry entry = entries[i];
- if (entry.getEntryKind() == IIncludePathEntry.CPE_LIBRARY
- && entry.getContentKind() == IPackageFragmentRoot.K_BINARY
- && "/AttachedJavadocProject/lib/test6.jar".equals(entry.getPath().toString())) { //$NON-NLS-1$
- entries[i] = JavaScriptCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), new IIncludePathAttribute[] { attribute }, entry.isExported());
- }
- }
- this.project.setRawIncludepath(entries, null);
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IField field = type.getField("f"); //$NON-NLS-1$
- assertNotNull(field);
- String javadoc = field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- } finally {
- // restore classpath
- if (savedEntries != null) {
- this.project.setRawIncludepath(savedEntries, null);
- }
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=120597
- public void test011() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("Z.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IField field = type.getField("out"); //$NON-NLS-1$
- assertNotNull(field);
- String javadoc = field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=120637
- public void test012() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("Z.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- assertTrue("Should not contain reference to out", javadoc.indexOf("out") == -1);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=120559
- public void test013() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("W.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNull("Should not have a javadoc", javadoc); //$NON-NLS-1$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=120637
- public void test014() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("E.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- assertTrue("Should not contain reference to Constant C", javadoc.indexOf("Constant C") == -1);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=120637
- public void test015() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("Annot.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- assertTrue("Should not contain reference to name", javadoc.indexOf("name") == -1);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=120847
- public void test016() throws JavaScriptModelException {
- IIncludePathEntry[] savedEntries = null;
- try {
- IIncludePathEntry[] entries = this.project.getRawIncludepath();
- savedEntries = (IIncludePathEntry[]) entries.clone();
- IIncludePathAttribute attribute = JavaScriptCore.newIncludepathAttribute(IIncludePathAttribute.JSDOC_LOCATION_ATTRIBUTE_NAME, "invalid_path");
- for (int i = 0, max = entries.length; i < max; i++) {
- final IIncludePathEntry entry = entries[i];
- if (entry.getEntryKind() == IIncludePathEntry.CPE_LIBRARY
- && entry.getContentKind() == IPackageFragmentRoot.K_BINARY
- && "/AttachedJavadocProject/lib/test6.jar".equals(entry.getPath().toString())) { //$NON-NLS-1$
- entries[i] = JavaScriptCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), new IIncludePathAttribute[] { attribute }, entry.isExported());
- }
- }
- this.project.setRawIncludepath(entries, null);
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IField field = type.getField("f"); //$NON-NLS-1$
- assertNotNull(field);
- field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertFalse("Should be unreachable", true);
- } catch(JavaScriptModelException e) {
- assertTrue("Must occur", true);
- assertEquals("Wrong error message", "Cannot retrieve the attached javadoc for invalid_path", e.getMessage());
- } finally {
- // restore classpath
- if (savedEntries != null) {
- this.project.setRawIncludepath(savedEntries, null);
- }
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=120875
- public void test017() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("Annot2.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- assertTrue("Should not contain reference to name2", javadoc.indexOf("name2") == -1);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=138167
- public void test018() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2/p3"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("C.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IFunction[] methods = type.getFunctions();
- NullProgressMonitor monitor = new NullProgressMonitor();
- for (int i = 0, max = methods.length; i < max; i++) {
- IFunction method = methods[i];
- String javadoc = method.getAttachedJavadoc(monitor);
- assertNotNull("Should have a javadoc", javadoc);
- final String selector = method.getElementName();
- assertTrue("Wrong doc", javadoc.indexOf(selector) != -1);
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=138167
- public void test019() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2/p3"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("C.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IFunction method = type.getFunction("bar5", new String[] {"Ljava.util.Map;", "I", "Ljava.util.Map;"}); //$NON-NLS-1$
- assertTrue(method.exists());
- String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$
- String[] names = method.getParameterNames();
- assertNotNull("No names", names);
- assertEquals("Wrong size", 3, names.length);
- assertEquals("Wrong parameter name", "m", names[0]);
- assertEquals("Wrong parameter name", "j", names[1]);
- assertEquals("Wrong parameter name", "m2", names[2]);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=139160
- public void test020() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("Z.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IFunction method = type.getFunction("foo", new String[] {"I", "I"}); //$NON-NLS-1$
- assertTrue(method.exists());
- String javadoc = null;
- try {
- javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- } catch(JavaScriptModelException e) {
- assertTrue("Should not happen", false);
- }
- assertNull("Should not have a javadoc", javadoc); //$NON-NLS-1$
- String[] paramNames = method.getParameterNames();
- assertNotNull(paramNames);
- assertEquals("Wrong size", 2, paramNames.length); //$NON-NLS-1$
- assertEquals("Wrong name", "arg0", paramNames[0]); //$NON-NLS-1$
- assertEquals("Wrong name", "arg1", paramNames[1]); //$NON-NLS-1$
- }
-
- /*
- * Ensures that calling getAttachedJavadoc(...) on a binary method
- * has no side-effect on the underlying Java model cache.
- * (regression test for bug 140879 Spontaneous error "java.util.Set cannot be resolved...")
- */
- public void test021() throws CoreException, IOException {
- IJavaScriptUnit workingCopy = null;
- try {
- IPackageFragment p = this.root.getPackageFragment("p2");
- IType type = p.getClassFile("X.class").getType();
- IFunction method = type.getFunction("foo", new String[0]);
-
- // the following call should have no side-effect
- method.getAttachedJavadoc(null);
-
- // ensure no side-effect
- ProblemRequestor problemRequestor = new ProblemRequestor();
- workingCopy = getWorkingCopy(
- "/AttachedJavadocProject/src/Test.js",
- "import p2.Y;\n" +
- "public class Test extends Y { }",
- new WorkingCopyOwner() {},
- problemRequestor
- );
- assertProblems(
- "Unexpected problems",
- "----------\n" +
- "----------\n",
- problemRequestor);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- deleteProject("P");
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=149154
- public void test022() throws JavaScriptModelException {
- IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$
- assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$
- IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$
- assertNotNull(classFile);
- IType type = classFile.getType();
- IFunction method = type.getFunction("access$1", new String[] {"Lp1.p2.X;", "I"}); //$NON-NLS-1$
- assertTrue(method.exists());
- String javadoc = null;
- try {
- javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$
- } catch(JavaScriptModelException e) {
- assertTrue("Should not happen", false);
- }
- assertNull("Should not have a javadoc", javadoc); //$NON-NLS-1$
- String[] paramNames = method.getParameterNames();
- assertNotNull(paramNames);
- assertEquals("Wrong size", 2, paramNames.length); //$NON-NLS-1$
- assertEquals("Wrong name", "arg0", paramNames[0]); //$NON-NLS-1$
- assertEquals("Wrong name", "arg1", paramNames[1]); //$NON-NLS-1$
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BindingKeyTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BindingKeyTests.java
deleted file mode 100644
index 11a08b9..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BindingKeyTests.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import org.eclipse.wst.jsdt.core.BindingKey;
-
-import junit.framework.Test;
-
-public class BindingKeyTests extends AbstractJavaModelTests {
-
- static {
- }
-
- public BindingKeyTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- return buildModelTestSuite(BindingKeyTests.class);
- }
-
- protected void assertBindingKeyEquals(String expected, String key) {
- if (!(expected.equals(key)))
- System.out.println(displayString(key, 3) + ",");
- assertEquals(expected, key);
- }
-
- protected void assertBindingKeySignatureEquals(String expected, String key) {
- BindingKey bindingKey = new BindingKey(key);
- String signature = bindingKey.toSignature();
- if (!(expected.equals(signature)))
- System.out.println(displayString(signature, 3) + ",");
- assertEquals(expected, signature);
- }
-
- /*
- * Package.
- */
- public void test001() {
- assertBindingKeySignatureEquals(
- "p",
- "p"
- );
- }
-
- /*
- * Top level type in non default package.
- */
- public void test002() {
- assertBindingKeySignatureEquals(
- "Lp.X;",
- "Lp/X;"
- );
- }
-
- /*
- * Top level type in default package.
- */
- public void test003() {
- assertBindingKeySignatureEquals(
- "LClazz;",
- "LClazz;"
- );
- }
-
- /*
- * Member type
- */
- public void test004() {
- assertBindingKeySignatureEquals(
- "Lp.X$Member;",
- "Lp/X$Member;"
- );
- }
-
- /*
- * Member type (2 levels deep)
- */
- public void test005() {
- assertBindingKeySignatureEquals(
- "Lp1.X$Member1$Member2;",
- "Lp1/X$Member1$Member2;"
- );
- }
-
- /*
- * Anonymous type
- */
- public void test006() {
- assertBindingKeySignatureEquals(
- "Lp1.X$1;",
- "Lp1/X$1;"
- );
- }
-
- /*
- * Local type
- */
- public void test007() {
- assertBindingKeySignatureEquals(
- "Lp1.X$1$Y;",
- "Lp1/X$1$Y;"
- );
- }
-
- /*
- * Array type
- */
- public void test008() {
- assertBindingKeySignatureEquals(
- "[Lp1.X;",
- "[Lp1/X;"
- );
- }
-
- /*
- * Secondary type
- */
- public void test012() {
- assertBindingKeySignatureEquals(
- "Lp1.Secondary;",
- "Lp1/X~Secondary;"
- );
- }
-
- /*
- * Anonymous in a secondary type
- */
- public void test013() {
- assertBindingKeySignatureEquals(
- "Lp1.Secondary$1;",
- "Lp1/X~Secondary$1;"
- );
- }
-
- /*
- * Method
- * (regression test for bug 85811 BindingKey.toSignature should return method signature for methods)
- */
- public void test014() {
- assertBindingKeySignatureEquals(
- "(Ljava.lang.String;I)Z",
- "Lp1/X;.foo(Ljava/lang/String;I)Z"
- );
- }
-
- /*
- * Create a type binding key from a fully qualified name
- */
- public void test015() {
- String key = BindingKey.createTypeBindingKey("java.lang.Object");
- assertBindingKeyEquals(
- "Ljava/lang/Object;",
- key);
- }
-
- /*
- * Create a type binding key from an array type name
- */
- public void test017() {
- String key = BindingKey.createTypeBindingKey("Boolean[]");
- assertBindingKeyEquals(
- "[LBoolean;",
- key);
- }
-
- /*
- * Create an array type binding key
- */
- public void test020() {
- String key = BindingKey.createArrayTypeBindingKey("Ljava/lang/Object;", 1);
- assertBindingKeyEquals(
- "[Ljava/lang/Object;",
- key);
- }
-
- /*
- * Create an array type binding key
- */
- public void test021() {
- String key = BindingKey.createArrayTypeBindingKey("I", 2);
- assertBindingKeyEquals(
- "[[I",
- key);
- }
-
- /*
- * Method starting with an upper case corresponding to a primitive type
- * (regression test for bug 94398 Error attempting to find References)
- */
- public void test034() {
- assertBindingKeySignatureEquals(
- "(Ljava.lang.String;I)Z",
- "Lp1/X;.Set(Ljava/lang/String;I)Z"
- );
- }
-
- /*
- * Field
- * (regression test for bug 87362 BindingKey#internalToSignature() should return the field's type signature)
- */
- public void test037() {
- assertBindingKeySignatureEquals(
- "Ljava.lang.String;",
- "Lp/X;.foo)Ljava/lang/String;"
- );
- }
-
- /*
- * Base type
- * (regression test for bug 97187 [rendering] Shows Single Char for primitve Types)
- */
- public void test039() {
- assertBindingKeySignatureEquals(
- "Z",
- "Z"
- );
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BufferTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BufferTests.java
deleted file mode 100644
index 7d1cd0a..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BufferTests.java
+++ /dev/null
@@ -1,424 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.wst.jsdt.core.*;
-
-import junit.framework.Test;
-
-public class BufferTests extends ModifyingResourceTests implements
- IBufferChangedListener {
- protected ArrayList events = null;
-
- public BufferTests(String name) {
- super(name);
- }
-
- /**
- * Cache the event
- */
- public void bufferChanged(BufferChangedEvent bufferChangedEvent) {
- this.events.add(bufferChangedEvent);
- }
-
- protected IBuffer createBuffer(String path, String content)
- throws CoreException {
- waitUntilIndexesReady(); // ensure that the indexer is not reading the
- // file
- this.createFile(path, content);
- IJavaScriptUnit cu = this.getCompilationUnit(path);
- IBuffer buffer = cu.getBuffer();
- buffer.addBufferChangedListener(this);
- this.events = new ArrayList();
- return buffer;
- }
-
- protected void deleteBuffer(IBuffer buffer) throws CoreException {
- buffer.removeBufferChangedListener(this);
- IResource resource = buffer.getUnderlyingResource();
- if (resource != null) {
- deleteResource(resource);
- }
- }
-
- /**
- * @see AbstractJavaModelTests#setUpSuite()
- */
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- try {
- this.createJavaProject("P", new String[] { "" });
- this.createFolder("P/x/y");
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see AbstractJavaModelTests#tearDownSuite()
- */
- public void tearDownSuite() throws Exception {
- super.tearDownSuite();
- this.deleteProject("P");
- }
-
- public static Test suite() {
- return buildModelTestSuite(BufferTests.class);
- }
-
- /**
- * Tests appending to a buffer.
- */
- public void testAppend() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- int oldLength = buffer.getLength();
- buffer.append("\nvar a = new A();");
- assertBufferEvent(oldLength, 0, "\nvar a = new A();");
- assertSourceEquals("unexpected buffer contents", "function A() {\n};"
- + "\nvar a = new A();", buffer.getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests appending to a read-only buffer.
- */
- //TODO
- /*public void testAppendReadOnly() throws CoreException {
- IBuffer buffer = null;
- try {
- createJavaProject("P1", new String[] {}, "");
- // IClassFile classFile = getClassFile("P1",
- // getExternalJCLPathString(), "", "system.js");
- IJavaScriptUnit unit = getCompilationUnit("P1",
- getExternalJCLPathString(), "", "system.js");
- buffer = unit.getBuffer();
- buffer.addBufferChangedListener(this);
- this.events = new ArrayList();
- buffer.append("\nclass B {}");
- assertTrue("unexpected event", this.events.isEmpty());
- assertSourceEquals("unexpected buffer contents",
- "package java.lang;\n" + "\n" + "public class String {\n"
- + "}\n", buffer.getContents());
- assertTrue("should not have unsaved changes", !buffer
- .hasUnsavedChanges());
- } finally {
- if (buffer != null) {
- buffer.removeBufferChangedListener(this);
- }
- deleteProject("P1");
- }
- }*/
-
- public void testClose() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- buffer.close();
- assertBufferEvent(0, 0, null);
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests getting the underlying resource of a buffer.
- */
- public void testGetUnderlyingResource() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- IJavaScriptUnit copy = null;
- try {
- IFile file = this.getFile("P/x/y/A.js");
- assertEquals("Unexpected underlying resource", file, buffer
- .getUnderlyingResource());
-
- copy = this.getCompilationUnit("P/x/y/A.js").getWorkingCopy(null);
- assertEquals("Unexpected underlying resource 2", file, copy
- .getBuffer().getUnderlyingResource());
- } finally {
- this.deleteBuffer(buffer);
- if (copy != null) {
- copy.discardWorkingCopy();
- }
- }
- }
-
- /**
- * Tests deleting text at the beginning of a buffer.
- */
- public void testDeleteBeginning() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};\n" +
- "var a = new A();");
- try {
- buffer.replace(0, 18, "");
- assertBufferEvent(0, 18, null);
- assertSourceEquals("unexpected buffer contents",
- "var a = new A();", buffer.getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests deleting text in the middle of a buffer.
- */
- public void testDeleteMiddle() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};\n" +
- "var a = new A();\nvar a1 = new A();");
- try {
- // delete var a = new A();\n
- buffer.replace(18, 17, "");
- assertBufferEvent(18, 17, null);
- assertSourceEquals("unexpected buffer contents", "function A() {\n};\n" +
- "var a1 = new A();", buffer.getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests deleting text at the end of a buffer.
- */
- public void testDeleteEnd() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};\n" +
- "var a = new A();");
- try {
- // delete "public class A {\n}"
- buffer.replace(17, 17, "");
- assertBufferEvent(17, 17, null);
- assertSourceEquals("unexpected buffer contents", "function A() {\n};",
- buffer.getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests the buffer char retrieval via source position
- */
- public void testGetChar() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- assertEquals("Unexpected char at position 9", 'A', buffer
- .getChar(9));
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests the buffer char retrieval via source position doesn't throw an
- * exception if the buffer is closed.
- */
- public void testGetChar2() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- buffer.close();
- try {
- assertEquals("Unexpected char at position 9", Character.MIN_VALUE,
- buffer.getChar(9));
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests the buffer getLength()
- */
- public void testGetLength() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- assertEquals("Unexpected length", 17, buffer.getLength());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests the buffer text retrieval via source position
- */
- public void testGetText() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- assertSourceEquals("Unexpected text (1)", "f", buffer.getText(0, 1));
- assertSourceEquals("Unexpected text (2)", "A()", buffer.getText(
- 9, 3));
- assertSourceEquals("Unexpected text (3)", "", buffer.getText(12, 0));
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests inserting text at the beginning of a buffer.
- */
- public void testInsertBeginning() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- buffer.replace(0, 0, "/* copyright mycompany */\n");
- assertBufferEvent(0, 0, "/* copyright mycompany */\n");
- assertSourceEquals("unexpected buffer contents",
- "/* copyright mycompany */\n" + "function A() {\n};",
- buffer.getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests replacing text at the beginning of a buffer.
- */
- public void testReplaceBeginning() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- // replace function A() with function B()
- buffer.replace(0, 12, "function B()");
- assertBufferEvent(0, 12, "function B()");
- assertSourceEquals("unexpected buffer contents", "function B() {\n};",
- buffer.getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests replacing text in the middle of a buffer.
- */
- public void testReplaceMiddle() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- // replace "A()" after the \n of package statement
- buffer.replace(9, 3, "B( )");
- assertBufferEvent(9, 3, "B( )");
- assertSourceEquals("unexpected buffer contents", "function B( ) {\n};",
- buffer.getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests replacing text at the end of a buffer.
- */
- public void testReplaceEnd() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- // replace ";" at the end of cu with ";\n"
- int end = buffer.getLength();
- buffer.replace(end - 1, 1, ";\n");
- assertBufferEvent(end - 1, 1, ";\n");
- assertSourceEquals("unexpected buffer contents", "function A() {\n};\n",
- buffer.getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests inserting text in the middle of a buffer.
- */
- public void testInsertMiddle() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A() {\n};");
- try {
- // insert comment in the middle of the {\n}
- buffer.replace(15, 0, "// comment\n");
- assertBufferEvent(15, 0, "// comment\n");
- assertSourceEquals("unexpected buffer contents",
- "function A() {\n// comment\n};",
- buffer.getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Tests inserting text at the end of a buffer.
- */
- public void testInsertEnd() throws CoreException {
- IBuffer buffer = this.createBuffer("P/x/y/A.js", "function A(){\n};");
- try {
- // insert function B(){\n} at the end of the buffer
- int end = buffer.getLength();
- buffer.replace(end, 0, "\nfunction B(){\n};");
- assertBufferEvent(end, 0, "\nfunction B(){\n};");
- assertSourceEquals("unexpected buffer contents",
- "function A(){\n};\nfunction B(){\n};", buffer
- .getContents());
- assertTrue("should have unsaved changes", buffer
- .hasUnsavedChanges());
- } finally {
- this.deleteBuffer(buffer);
- }
- }
-
- /**
- * Verify the buffer changed event. The given text must contain '\n' line
- * separators.
- */
- protected void assertBufferEvent(int offset, int length, String text) {
- assertTrue("events should not be null", this.events != null);
- assertTrue("events should not be empty", !this.events.isEmpty());
- BufferChangedEvent event = (BufferChangedEvent) this.events.get(0);
- assertEquals("unexpected offset", offset, event.getOffset());
- assertEquals("unexpected length", length, event.getLength());
- if (text == null) {
- assertTrue("text should be null", event.getText() == null);
- } else {
- assertSourceEquals("unexpected text", text, event.getText());
- }
- }
-
- protected void assertBufferEvents(String expected) {
- StringBuffer buffer = new StringBuffer();
- if (this.events == null)
- buffer.append("");
- else {
- for (int i = 0, length = this.events.size(); i < length; i++) {
- BufferChangedEvent event = (BufferChangedEvent) this.events
- .get(i);
- buffer.append('(');
- buffer.append(event.getOffset());
- buffer.append(", ");
- buffer.append(event.getLength());
- buffer.append(") ");
- buffer.append(event.getText());
- if (i < length - 1)
- buffer.append("\n");
- }
- }
- assertSourceEquals("Unexpected buffer events", expected, buffer
- .toString());
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CancelCounter.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CancelCounter.java
deleted file mode 100644
index 033b9b2..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CancelCounter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/*
- * Counts the number of time isCancelled() is called.
- */
-public class CancelCounter implements IProgressMonitor {
- public int count = 0;
- public void beginTask(String name, int totalWork) {}
- public void done() {}
- public void internalWorked(double work) {}
- public boolean isCanceled() {
- count++;
- return false;
- }
- public void setCanceled(boolean value) {}
- public void setTaskName(String name) {}
- public void subTask(String name) {}
- public void worked(int work) {}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/Canceler.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/Canceler.java
deleted file mode 100644
index 01bd795..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/Canceler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/*
- * Cancels the operation on the count time isCanceled() is called.
- */
-public class Canceler implements IProgressMonitor {
- int count;
- public Canceler(int count) {
- this.count = count;
- }
- public void beginTask(String name, int totalWork) {}
- public void done() {}
- public void internalWorked(double work) {}
- public boolean isCanceled() {
- return --count < 0;
- }
- public void setCanceled(boolean value) {}
- public void setTaskName(String name) {}
- public void subTask(String name) {}
- public void worked(int work) {}
-}
-
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassFileTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassFileTests.java
deleted file mode 100644
index 24815a6..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassFileTests.java
+++ /dev/null
@@ -1,824 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.model;
-
-import java.io.IOException;
-
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.jsdt.core.Flags;
-import org.eclipse.wst.jsdt.core.IClassFile;
-import org.eclipse.wst.jsdt.core.IFunction;
-import org.eclipse.wst.jsdt.core.IJavaScriptElement;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.IPackageFragment;
-import org.eclipse.wst.jsdt.core.IPackageFragmentRoot;
-import org.eclipse.wst.jsdt.core.IType;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.WorkingCopyOwner;
-import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchConstants;
-import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchScope;
-import org.eclipse.wst.jsdt.core.search.SearchEngine;
-
-public class ClassFileTests extends ModifyingResourceTests {
-
- IPackageFragmentRoot jarRoot;
- IJavaScriptUnit workingCopy;
- IClassFile classFile;
-
-public ClassFileTests(String name) {
- super(name);
-}
-
-// Use this static initializer to specify subset for tests
-// All specified tests which do not belong to the class are skipped...
-static {
-// TESTS_PREFIX = "testGetCategories";
-// TESTS_NAMES = new String[] { "testWorkingCopy11"};
-// TESTS_NUMBERS = new int[] { 13 };
-// TESTS_RANGE = new int[] { 16, -1 };
-}
-public static Test suite() {
- return buildModelTestSuite(ClassFileTests.class);
-}
-
-public void setUpSuite() throws Exception {
- super.setUpSuite();
- IJavaScriptProject javaProject = createJavaProject("P");
- String[] pathAndContents = new String[] {
- "nongeneric/A.js",
- "package nongeneric;\n" +
- "public class A {\n" +
- "}",
- "generic/X.js",
- "package generic;\n" +
- "public class X {\n" +
- " X