Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

This commit was manufactured by cvs2svn to create tag 'v200912081640'.

  • Loading branch information...
commit 6ce8625f89578d4840b0021d14ff1872eaff2ef2 1 parent 3d8e78a
nitind authored
Showing with 0 additions and 82,686 deletions.
  1. +0 −7 tests/org.eclipse.wst.jsdt.core.tests.compiler/.classpath
  2. +0 −2  tests/org.eclipse.wst.jsdt.core.tests.compiler/.cvsignore
  3. +0 −28 tests/org.eclipse.wst.jsdt.core.tests.compiler/.project
  4. +0 −3  tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.core.resources.prefs
  5. +0 −7 tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs
  6. +0 −22 tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF
  7. +0 −28 tests/org.eclipse.wst.jsdt.core.tests.compiler/about.html
  8. +0 −18 tests/org.eclipse.wst.jsdt.core.tests.compiler/build.properties
  9. +0 −16 tests/org.eclipse.wst.jsdt.core.tests.compiler/plugin.properties
  10. +0 −146 ...rg.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java
  11. +0 −481 ...st.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/AbstractCompletionTest.java
  12. +0 −333 ...wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/AbstractSelectionTest.java
  13. +0 −194 ....tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java
  14. +0 −214 ...re.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java
  15. +0 −8,713 ....wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest.java
  16. +0 −9,671 ...wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest2.java
  17. +0 −15,538 ...dt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTestKeyword.java
  18. +0 −1,031 ...st.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionRecoveryTest.java
  19. +0 −2,375 ...st.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java
  20. +0 −2,033 ...se.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DietCompletionTest.java
  21. +0 −7,680 ...ipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DietRecoveryTest.java
  22. +0 −359 ....jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DualParseSyntaxErrorTest.java
  23. +0 −385 ...mpiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java
  24. +0 −229 ...ompiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java
  25. +0 −2,424 ...jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/FieldAccessCompletionTest.java
  26. +0 −102 ...t.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/InMemoryNameEnvironment.java
  27. +0 −456 ...t.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/InnerTypeCompletionTest.java
  28. +0 −545 ...dt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
  29. +0 −492 ...t.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/LabelStatementCompletionTest.java
  30. +0 −863 ...core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java
  31. +0 −923 ...dt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/NameReferenceCompletionTest.java
  32. +0 −693 ...rg.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ParserTest.java
  33. +0 −1,553 ...dt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java
  34. +0 −108 ....jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/RunCompletionParserTests.java
  35. +0 −865 ....wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionJavadocTest.java
  36. +0 −2,579 ...eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest.java
  37. +0 −229 ...clipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest2.java
  38. +0 −57 ....wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SingleCompletionTest.java
  39. +0 −5,261 ...t.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceElementParserTest.java
  40. +0 −122 ...g.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceField.java
  41. +0 −52 ....eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceImport.java
  42. +0 −32 ...pse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceInitializer.java
  43. +0 −192 ....eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceMethod.java
  44. +0 −49 ...eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourcePackage.java
  45. +0 −271 ...rg.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceType.java
  46. +0 −268 ...rg.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceUnit.java
  47. +0 −3,734 ...wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java
  48. +0 −192 ...lipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SyntaxErrorTest.java
  49. +0 −120 ...s/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/TestAll.java
  50. +0 −120 ...sdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/TestSourceElementRequestor.java
  51. +0 −995 ...ipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ASTImplTests.java
  52. +0 −49 ...sdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractComparableTest.java
  53. +0 −1,720 ...sdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractRegressionTest.java
  54. +0 −614 ...se.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AssignmentTest.java
  55. +0 −197 ...wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicAnalyseTests.java
  56. +0 −57 ...e.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicErrorTests.java
  57. +0 −210 ...e.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicJsdocTests.java
  58. +0 −1,017 ....wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java
  59. +0 −1,544 ...wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicResolveTests.java
  60. +0 −109 ...wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/CharOperationTest.java
  61. +0 −791 ...dt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/CompilerInvocationTests.java
  62. +0 −273 ...se.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/Compliance_1_3.java
  63. +0 −737 ...se.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/DeprecatedTest.java
  64. +0 −227 ...tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiterals15Test.java
  65. +0 −515 ...e.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java
  66. +0 −199 ...e.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/FieldAccessTest.java
  67. +0 −1,242 ....wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/FlowAnalysisTest.java
  68. +0 −77 ....wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ForStatementTest.java
  69. +0 −115 ...dt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
  70. +0 −183 ...wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferResolveTests.java
Sorry, we could not display the entire diff because too many files (4,101) changed.
View
7 tests/org.eclipse.wst.jsdt.core.tests.compiler/.classpath
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
View
2  tests/org.eclipse.wst.jsdt.core.tests.compiler/.cvsignore
@@ -1,2 +0,0 @@
-build.xml
-javaCompiler...args
View
28 tests/org.eclipse.wst.jsdt.core.tests.compiler/.project
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.jsdt.core.tests.compiler</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
View
3  tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +0,0 @@
-#Wed Dec 12 03:20:36 EST 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
View
7 tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +0,0 @@
-#Wed Dec 12 03:10:27 EST 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
View
22 tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF
@@ -1,22 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.wst.jsdt.core.tests.compiler; singleton:=true
-Bundle-Version: 1.0.300.qualifier
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.wst.jsdt.core;bundle-version="[1.1.0,2.0.0)",
- org.junit;bundle-version="[3.8.2,4.0.0)"
-Export-Package: org.eclipse.wst.jsdt.core.tests.compiler,
- org.eclipse.wst.jsdt.core.tests.compiler.parser,
- org.eclipse.wst.jsdt.core.tests.compiler.regression,
- org.eclipse.wst.jsdt.core.tests.eval.target,
- org.eclipse.wst.jsdt.core.tests.future.compiler.regression,
- org.eclipse.wst.jsdt.core.tests.interpret,
- org.eclipse.wst.jsdt.core.tests.junit.extension,
- org.eclipse.wst.jsdt.core.tests.runtime,
- org.eclipse.wst.jsdt.core.tests.util
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Bundle-ActivationPolicy: lazy
View
28 tests/org.eclipse.wst.jsdt.core.tests.compiler/about.html
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
View
18 tests/org.eclipse.wst.jsdt.core.tests.compiler/build.properties
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 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
-###############################################################################
-bin.includes = test.xml,\
- .,\
- plugin.properties,\
- META-INF/,\
- about.html
-src.includes = test.xml
-source.. = src/
-jars.compile.order = .
View
16 tests/org.eclipse.wst.jsdt.core.tests.compiler/plugin.properties
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 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
-###############################################################################
-
-#
-# Messages in plugin.xml.
-#
-pluginName=JSDT Tests - Compiler
-providerName=Eclipse.org
View
146 ...t.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java
@@ -1,146 +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.compiler;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.tests.compiler.parser.SyntaxErrorTest;
-import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicAnalyseTests;
-import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicParserTests;
-import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicResolveTests;
-import org.eclipse.wst.jsdt.core.tests.compiler.regression.CharOperationTest;
-import org.eclipse.wst.jsdt.core.tests.compiler.regression.InferTypesTests;
-import org.eclipse.wst.jsdt.core.tests.compiler.regression.UtilTest;
-import org.eclipse.wst.jsdt.core.tests.interpret.BasicInterpretTest;
-
-/**
- * Run all compiler regression tests
- */
-public class JSDTCompilerTests extends TestSuite {
-
-static {
- JavaScriptCore.getPlugin().getPluginPreferences().setValue("semanticValidation", true);
-}
-
-public JSDTCompilerTests() {
- this("JavaScript Model Tests");
-}
-
-public JSDTCompilerTests(String testName) {
- super(testName);
-}
-public static Test suite() {
-
- ArrayList standardTests = new ArrayList();
-
- // regression tests
- standardTests.add(BasicParserTests.class);
- standardTests.add(InferTypesTests.class);
- standardTests.add(BasicResolveTests.class);
- standardTests.add(BasicAnalyseTests.class);
- standardTests.add(CharOperationTest.class);
- standardTests.add(UtilTest.class);
-
- // parser tests
- standardTests.add(SyntaxErrorTest.class);
-
- // interpret tests
- standardTests.add(BasicInterpretTest.class);
-
-
-
-
-// standardTests.addAll(JavadocTest.allTestClasses);
-
-// standardTests.add(BasicErrorTests.class);
-
- // // add all javadoc tests
-// for (int i=0, l=JavadocTest.ALL_CLASSES.size(); i<l; i++) {
-// standardTests.add(JavadocTest.ALL_CLASSES.get(i));
-// }
-//
- TestSuite all = new TestSuite("JSDT 'Compiler' Tests");
-// int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels();
-// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_3) != 0) {
-// ArrayList tests_1_3 = (ArrayList)standardTests.clone();
-// tests_1_3.add(Compliance_1_3.class);
-// tests_1_3.add(JavadocTest_1_3.class);
-// // Reset forgotten subsets tests
-// TestCase.TESTS_PREFIX = null;
-// TestCase.TESTS_NAMES = null;
-// TestCase.TESTS_NUMBERS= null;
-// TestCase.TESTS_RANGE = null;
-// TestCase.RUN_ONLY_ID = null;
-// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_3, tests_1_3));
-// }
-// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_4) != 0) {
-// ArrayList tests_1_4 = (ArrayList)standardTests.clone();
-// tests_1_4.add(AssertionTest.class);
-// tests_1_4.add(Compliance_1_4.class);
-// tests_1_4.add(ClassFileReaderTest_1_4.class);
-// tests_1_4.add(JavadocTest_1_4.class);
-// // Reset forgotten subsets tests
-// TestCase.TESTS_PREFIX = null;
-// TestCase.TESTS_NAMES = null;
-// TestCase.TESTS_NUMBERS= null;
-// TestCase.TESTS_RANGE = null;
-// TestCase.RUN_ONLY_ID = null;
-// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_4, tests_1_4));
-// }
-// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_5) != 0) {
-// ArrayList tests_1_5 = (ArrayList)standardTests.clone();
-// tests_1_5.addAll(RunComparableTests.ALL_CLASSES);
-// tests_1_5.add(AssertionTest.class);
-// tests_1_5.add(ClassFileReaderTest_1_5.class);
-// tests_1_5.add(GenericTypeSignatureTest.class);
-// tests_1_5.add(InternalHexFloatTest.class);
-// tests_1_5.add(JavadocTest_1_5.class);
-// tests_1_5.add(BatchCompilerTest.class);
-// tests_1_5.add(ExternalizeStringLiterals15Test.class);
-// // Reset forgotten subsets tests
-// TestCase.TESTS_PREFIX = null;
-// TestCase.TESTS_NAMES = null;
-// TestCase.TESTS_NUMBERS= null;
-// TestCase.TESTS_RANGE = null;
-// TestCase.RUN_ONLY_ID = null;
-// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_5, tests_1_5));
-// }
-// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) {
-// ArrayList tests_1_6 = (ArrayList)standardTests.clone();
-// tests_1_6.addAll(RunComparableTests.ALL_CLASSES);
-// tests_1_6.add(AssertionTest.class);
-// tests_1_6.add(ClassFileReaderTest_1_5.class);
-// tests_1_6.add(GenericTypeSignatureTest.class);
-// tests_1_6.add(InternalHexFloatTest.class);
-// tests_1_6.add(JavadocTest_1_5.class);
-// tests_1_6.add(BatchCompilerTest.class);
-// tests_1_6.add(ExternalizeStringLiterals15Test.class);
-// tests_1_6.add(StackMapAttributeTest.class);
-// // Reset forgotten subsets tests
-// TestCase.TESTS_PREFIX = null;
-// TestCase.TESTS_NAMES = null;
-// TestCase.TESTS_NUMBERS= null;
-// TestCase.TESTS_RANGE = null;
-// TestCase.RUN_ONLY_ID = null;
-// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_6, tests_1_6));
-// }
- for (Iterator iter = standardTests.iterator(); iter.hasNext();) {
- Class test = (Class) iter.next();
- all.addTestSuite(test);
- }
- return all;
-}
-}
View
481 ....compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/AbstractCompletionTest.java
@@ -1,481 +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.compiler.parser;
-
-import java.util.Locale;
-
-import org.eclipse.wst.jsdt.internal.codeassist.complete.CompletionParser;
-import org.eclipse.wst.jsdt.internal.codeassist.complete.CompletionScanner;
-import org.eclipse.wst.jsdt.internal.compiler.CompilationResult;
-import org.eclipse.wst.jsdt.internal.compiler.DefaultErrorHandlingPolicies;
-import org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration;
-import org.eclipse.wst.jsdt.internal.compiler.ast.ASTNode;
-import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration;
-import org.eclipse.wst.jsdt.internal.compiler.ast.FieldDeclaration;
-import org.eclipse.wst.jsdt.internal.compiler.ast.Initializer;
-import org.eclipse.wst.jsdt.internal.compiler.ast.TypeDeclaration;
-import org.eclipse.wst.jsdt.internal.compiler.batch.CompilationUnit;
-import org.eclipse.wst.jsdt.internal.compiler.env.ICompilationUnit;
-import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.wst.jsdt.internal.compiler.parser.Parser;
-import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory;
-import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemReporter;
-import org.eclipse.wst.jsdt.core.compiler.CharOperation;
-import org.eclipse.wst.jsdt.core.tests.util.AbstractCompilerTest;
-import org.eclipse.wst.jsdt.core.tests.util.Util;
-
-public abstract class AbstractCompletionTest extends AbstractCompilerTest {
-
- public final static String NONE = "<NONE>";
-public AbstractCompletionTest(String testName){
- super(testName);
-}
-/*
- * DietParse with completionNode check
- */
-public void checkDietParse(
- char[] source,
- int cursorLocation,
- String expectedCompletion,
- String expectedUnitToString,
- String expectedCompletionIdentifier,
- String expectedReplacedSource,
- String testName) {
- this.checkDietParse(
- source,
- cursorLocation,
- expectedCompletion,
- null,
- expectedUnitToString,
- expectedCompletionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * DietParse with completionNode check
- */
-public void checkDietParse(
- char[] source,
- int cursorLocation,
- String expectedCompletion,
- String expectedParentCompletion,
- String expectedUnitToString,
- String expectedCompletionIdentifier,
- String expectedReplacedSource,
- String testName) {
-
- CompilerOptions options = new CompilerOptions(getCompilerOptions());
- CompletionParser parser =
- new CompletionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())));
-
- ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
-
- CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, cursorLocation);
-
- String computedCompletion = parser.assistNode == null
- ? NONE
- : parser.assistNode.toString();
- String computedParentCompletion = parser.assistNodeParent == null
- ? NONE
- : parser.assistNodeParent.toString();
- String computedUnitToString = unit.toString();
- //System.out.println(computedUnitToString);
- //System.out.println(Util.displayString(computedUnitToString));
- //System.out.println(expectedUnitToString);
-
- if (!expectedCompletion.equals(computedCompletion)) {
- System.out.println(Util.displayString(computedCompletion));
- }
- assertEquals(
- "invalid completion node-" + testName,
- expectedCompletion,
- computedCompletion);
-
- if(expectedParentCompletion != null) {
- if (!expectedParentCompletion.equals(computedParentCompletion)) {
- System.out.println(Util.displayString(computedParentCompletion));
- }
- assertEquals(
- "invalid completion parent node-" + testName,
- expectedParentCompletion,
- computedParentCompletion);
- }
-
- if (!expectedUnitToString.equals(computedUnitToString)) {
- System.out.println(Util.displayString(computedUnitToString));
- }
- assertEquals(
- "invalid completion tree-" + testName,
- expectedUnitToString,
- computedUnitToString);
-
- if (expectedCompletionIdentifier != null){
- char[] chars = ((CompletionScanner)parser.scanner).completionIdentifier;
- String computedCompletionIdentifier = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid completion identifier-" + testName,
- expectedCompletionIdentifier,
- computedCompletionIdentifier);
- }
-
- if (expectedReplacedSource != null){
- char[] chars = null;
- if (parser.assistNode != null){
- chars = CharOperation.subarray(
- parser.scanner.source,
- parser.assistNode.sourceStart,
- parser.assistNode.sourceEnd + 1);
- } else {
- if (parser.assistIdentifier() != null){
- if (((CompletionScanner)parser.scanner).completedIdentifierEnd
- >= ((CompletionScanner)parser.scanner).completedIdentifierStart){
- chars = CharOperation.subarray(
- parser.scanner.source,
- ((CompletionScanner)parser.scanner).completedIdentifierStart,
- ((CompletionScanner)parser.scanner).completedIdentifierEnd + 1);
- }
- }
- }
- String computedReplacedSource = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid replaced source-" + testName,
- expectedReplacedSource,
- computedReplacedSource);
- }
-}
-/*
- * Parse a method with completionNode check
- */
-public void checkMethodParse(
- char[] source,
- int cursorLocation,
- String expectedCompletion,
- String expectedParentCompletion,
- String expectedUnitToString,
- String expectedCompletionIdentifier,
- String expectedReplacedSource,
- String[] expectedLabels,
- String testName) {
-
- assertTrue("bad cursor location",cursorLocation>=0);
- CompilerOptions options = new CompilerOptions(getCompilerOptions());
- CompletionParser parser =
- new CompletionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())));
-
- ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
-
- CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, cursorLocation);
-
- if (Parser.DO_DIET_PARSE)
- {
- ASTNode foundMethod = null;
- if (unit.types != null) {
- for (int i = 0; i < unit.types.length; i++) {
- TypeDeclaration type = unit.types[i];
- ASTNode method = findMethod(type, cursorLocation);
- if (method != null) {
- foundMethod = method;
- break;
- }
- }
- }
- assertTrue("no method found at cursor location", foundMethod != null);
- if (foundMethod instanceof AbstractMethodDeclaration) {
- parser.parseBlockStatements((AbstractMethodDeclaration)foundMethod, unit);
- } else {
- TypeDeclaration type = (TypeDeclaration)foundMethod;
- if (type.fields != null) {
- for (int i = 0; i < type.fields.length; i++) {
- FieldDeclaration field = type.fields[i];
- if (field.declarationSourceStart <= cursorLocation && (cursorLocation <= field.declarationSourceEnd || field.declarationSourceEnd == 0)) {
- if (field instanceof Initializer) {
- parser.parseBlockStatements((Initializer)field, type, unit);
- break;
- }
- assertTrue("TBD", false); // field initializer
- }
- }
- }
- }
- }
-
- String computedCompletion = parser.assistNode == null
- ? NONE
- : parser.assistNode.toString();
- String computedParentCompletion = parser.assistNodeParent == null
- ? NONE
- : parser.assistNodeParent.toString();
- String computedUnitToString = unit.toString();
-
- if (!expectedCompletion.equals(computedCompletion)) {
- System.out.println(Util.displayString(computedCompletion));
- }
- assertEquals(
- "invalid completion node-" + testName,
- expectedCompletion,
- computedCompletion);
-
- if(expectedParentCompletion != null) {
- if (!expectedParentCompletion.equals(computedParentCompletion)) {
- System.out.println(Util.displayString(computedParentCompletion));
- }
- assertEquals(
- "invalid completion parent node-" + testName,
- expectedParentCompletion,
- computedParentCompletion);
- }
-
- if (!expectedUnitToString.equals(computedUnitToString)) {
- System.out.println(Util.displayString(computedUnitToString));
- }
- assertEquals(
- "invalid completion location-"+testName,
- expectedUnitToString,
- computedUnitToString);
-
- if (expectedCompletionIdentifier != null){
- char[] chars = ((CompletionScanner)parser.scanner).completionIdentifier;
- String computedCompletionIdentifier = chars == null ? NONE : new String(chars);
- if (!expectedCompletionIdentifier.equals(computedCompletionIdentifier)) {
- System.out.println(Util.displayString(computedCompletionIdentifier));
- }
- assertEquals(
- "invalid completion identifier-" + testName,
- expectedCompletionIdentifier,
- computedCompletionIdentifier);
- }
- if (expectedReplacedSource != null){
- char[] chars = null;
- if (parser.assistNode != null){
- chars = CharOperation.subarray(
- parser.scanner.source,
- parser.assistNode.sourceStart,
- parser.assistNode.sourceEnd + 1);
- } else {
- if (parser.assistIdentifier() != null){
- if (((CompletionScanner)parser.scanner).completedIdentifierEnd
- >= ((CompletionScanner)parser.scanner).completedIdentifierStart){
- chars = CharOperation.subarray(
- parser.scanner.source,
- ((CompletionScanner)parser.scanner).completedIdentifierStart,
- ((CompletionScanner)parser.scanner).completedIdentifierEnd + 1);
- }
- }
- }
- String computedReplacedSource = chars == null ? NONE : new String(chars);
- if (!expectedReplacedSource.equals(computedReplacedSource)) {
- System.out.println(Util.displayString(computedReplacedSource));
- }
- assertEquals(
- "invalid replaced source-" + testName,
- expectedReplacedSource,
- computedReplacedSource);
- if (expectedReplacedSource.length() == 0) {
- assertEquals(
- "invalid insertion point-" + testName,
- cursorLocation + 1,
- parser.assistNode.sourceStart);
- }
- }
- if (expectedLabels != null) {
-// int length = (parser.labels == null) ? 0 : parser.labels.length;
-// assertEquals("invalid number of labels-" + testName, expectedLabels.length, length);
-// for (int i = 0; i < length; i++) {
-// String label = new String(parser.labels[i]);
-// assertEquals("invalid label-" + testName, expectedLabels[i], label);
-// }
- }
-}
-/*
- * Parse a method with completionNode check
- */
-public void checkMethodParse(
- char[] source,
- int cursorLocation,
- String expectedCompletion,
- String expectedUnitToString,
- String expectedCompletionIdentifier,
- String expectedReplacedSource,
- String testName) {
-
- this.checkMethodParse(
- source,
- cursorLocation,
- expectedCompletion,
- null,
- expectedUnitToString,
- expectedCompletionIdentifier,
- expectedReplacedSource,
- null,
- testName);
-}
-/*
- * Parse a method with completionNode check
- */
-public void checkMethodParse(
- char[] source,
- int cursorLocation,
- String expectedCompletion,
- String expectedParentCompletion,
- String expectedUnitToString,
- String expectedCompletionIdentifier,
- String expectedReplacedSource,
- String testName) {
-
- this.checkMethodParse(
- source,
- cursorLocation,
- expectedCompletion,
- expectedParentCompletion,
- expectedUnitToString,
- expectedCompletionIdentifier,
- expectedReplacedSource,
- null,
- testName);
-}
-/*
- * Parse a method with completionNode check
- */
-public void checkMethodParse(
- char[] source,
- int cursorLocation,
- String expectedCompletion,
- String expectedUnitToString,
- String expectedCompletionIdentifier,
- String expectedReplacedSource,
- String[] expectedLabels,
- String testName) {
-
- this.checkMethodParse(
- source,
- cursorLocation,
- expectedCompletion,
- null,
- expectedUnitToString,
- expectedCompletionIdentifier,
- expectedReplacedSource,
- expectedLabels,
- testName);
-}
-/*
- * Returns the method, the constructor or the type declaring the initializer
- * at the cursor location in the given type.
- * Returns null if not found.
- */
-private ASTNode findMethod(TypeDeclaration type, int cursorLocation) {
- if (type.methods != null) {
- for (int i = 0; i < type.methods.length; i++) {
- AbstractMethodDeclaration method = type.methods[i];
- if (method.declarationSourceStart <= cursorLocation && (cursorLocation <= method.declarationSourceEnd || method.declarationSourceEnd == 0)) {
- return method;
- }
- }
- }
- if (type.memberTypes != null) {
- for (int i = 0; i < type.memberTypes.length; i++) {
- TypeDeclaration memberType = type.memberTypes[i];
- ASTNode method = findMethod(memberType, cursorLocation);
- if (method != null) {
- return method;
- }
- }
- }
- if (type.fields != null) {
- for (int i = 0; i < type.fields.length; i++) {
- FieldDeclaration field = type.fields[i];
- if (field instanceof Initializer && field.declarationSourceStart <= cursorLocation && (cursorLocation <= field.declarationSourceEnd || field.declarationSourceEnd == 0)) {
- return type;
- }
- }
- }
- return null;
-}
-/**
- * Runs the given test that checks that diet completion parsing returns the given completion.
- */
-protected void runTestCheckDietParse(
- String compilationUnit,
- String completeBehind,
- String expectedCompletionNodeToString,
- String expectedUnitDisplayString,
- String expectedCompletionIdentifier,
- String expectedReplacedSource,
- String testName) {
-
- int cursorLocation = compilationUnit.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkDietParse(
- compilationUnit.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- expectedCompletionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/**
- * Runs the given test that checks that method completion parsing returns the given completion.
- */
-protected void runTestCheckMethodParse(
- String compilationUnit,
- String completeBehind,
- String expectedCompletionNodeToString,
- String expectedUnitDisplayString,
- String expectedCompletionIdentifier,
- String expectedReplacedSource,
- String[] expectedLabels,
- String testName) {
-
- int completeBehindStart = compilationUnit.indexOf(completeBehind);
- assertTrue("completeBehind string not found", completeBehindStart >= 0);
- int cursorLocation = completeBehindStart + completeBehind.length() - 1;
- this.checkMethodParse(
- compilationUnit.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- expectedCompletionIdentifier,
- expectedReplacedSource,
- expectedLabels,
- testName);
-}
-/**
- * Runs the given test that checks that method completion parsing returns the given completion.
- */
-protected void runTestCheckMethodParse(
- String compilationUnit,
- String completeBehind,
- String expectedCompletionNodeToString,
- String expectedUnitDisplayString,
- String expectedCompletionIdentifier,
- String expectedReplacedSource,
- String testName) {
-
- this.runTestCheckMethodParse(
- compilationUnit,
- completeBehind,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- expectedCompletionIdentifier,
- expectedReplacedSource,
- null,
- testName);
-}
-}
View
333 ...s.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/AbstractSelectionTest.java
@@ -1,333 +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.compiler.parser;
-
-import java.util.Locale;
-
-import org.eclipse.wst.jsdt.internal.codeassist.select.SelectionParser;
-import org.eclipse.wst.jsdt.internal.codeassist.select.SelectionScanner;
-import org.eclipse.wst.jsdt.internal.compiler.CompilationResult;
-import org.eclipse.wst.jsdt.internal.compiler.DefaultErrorHandlingPolicies;
-import org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration;
-import org.eclipse.wst.jsdt.internal.compiler.ast.ASTNode;
-import org.eclipse.wst.jsdt.internal.compiler.ast.Block;
-import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration;
-import org.eclipse.wst.jsdt.internal.compiler.ast.FieldDeclaration;
-import org.eclipse.wst.jsdt.internal.compiler.ast.Initializer;
-import org.eclipse.wst.jsdt.internal.compiler.ast.TypeDeclaration;
-import org.eclipse.wst.jsdt.internal.compiler.batch.CompilationUnit;
-import org.eclipse.wst.jsdt.internal.compiler.env.ICompilationUnit;
-import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.wst.jsdt.internal.compiler.parser.Parser;
-import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory;
-import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemReporter;
-import org.eclipse.wst.jsdt.core.compiler.CharOperation;
-import org.eclipse.wst.jsdt.core.tests.util.AbstractCompilerTest;
-import org.eclipse.wst.jsdt.core.tests.util.Util;
-
-public abstract class AbstractSelectionTest extends AbstractCompilerTest {
-
- public final static String NONE = "<NONE>";
-public AbstractSelectionTest(String testName){
- super(testName);
-}
-/*
- * DietParse with selectionNode check
- */
-public void checkDietParse(
- char[] source,
- int selectionStart,
- int selectionEnd,
- String expectedSelection,
- String expectedUnitToString,
- String expectedSelectionIdentifier,
- String expectedSelectedSource,
- String testName) {
-
- CompilerOptions options = new CompilerOptions(getCompilerOptions());
- SelectionParser parser =
- new SelectionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())));
-
- ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
-
- CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, selectionStart, selectionEnd);
-
- String computedUnitToString = unit.toString();
- //System.out.println(computedUnitToString);
- //System.out.println(Util.displayString(computedUnitToString));
- //System.out.println(expectedUnitToString);
-
- String computedSelection = parser.assistNode == null
- ? NONE
- : parser.assistNode.toString();
- assertEquals(
- "invalid selection node-" + testName,
- expectedSelection,
- computedSelection);
-
- if (!expectedUnitToString.equals(computedUnitToString)) {
- System.out.println(Util.displayString(computedUnitToString, 2));
- }
- assertEquals(
- "invalid selection unit-" + testName,
- expectedUnitToString,
- computedUnitToString);
-
- if (expectedSelectionIdentifier != null){
- char[] chars = ((SelectionScanner)parser.scanner).selectionIdentifier;
- String computedSelectionIdentifier = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid selection identifier-" + testName,
- expectedSelectionIdentifier,
- computedSelectionIdentifier);
- }
- if (expectedSelectedSource != null){
- char[] chars = null;
- if (parser.assistNode != null){
- chars = CharOperation.subarray(
- parser.scanner.source,
- parser.assistNode.sourceStart,
- parser.assistNode.sourceEnd + 1);
- } else {
- if (parser.assistIdentifier() != null){
- if (((SelectionScanner)parser.scanner).selectionEnd
- >= ((SelectionScanner)parser.scanner).selectionStart){
- chars = CharOperation.subarray(
- parser.scanner.source,
- ((SelectionScanner)parser.scanner).selectionStart,
- ((SelectionScanner)parser.scanner).selectionEnd + 1);
- }
- }
- }
- String computedSelectedSource = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid replaced source-" + testName,
- expectedSelectedSource,
- computedSelectedSource);
- }
-}
-/*
- * Parse a method with selectionNode check
- */
-public void checkMethodParse(
- char[] source,
- int selectionStart,
- int selectionEnd,
- String expectedSelection,
- String expectedUnitToString,
- String expectedSelectionIdentifier,
- String expectedSelectedSource,
- String[] expectedLabels,
- String testName) {
-
- CompilerOptions options = new CompilerOptions(getCompilerOptions());
- SelectionParser parser =
- new SelectionParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- options,
- new DefaultProblemFactory(Locale.getDefault())));
-
- ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
-
- CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, selectionStart, selectionEnd);
-
- if (Parser.DO_DIET_PARSE)
- {
- ASTNode foundMethod = null;
- if (unit.types != null) {
- for (int i = 0; i < unit.types.length; i++) {
- TypeDeclaration type = unit.types[i];
- ASTNode method = findMethod(type, selectionStart);
- if (method != null) {
- foundMethod = method;
- break;
- }
- }
- }
- assertTrue("no method found at cursor location", foundMethod != null);
- if (foundMethod instanceof AbstractMethodDeclaration) {
- parser.parseBlockStatements((AbstractMethodDeclaration)foundMethod, unit);
- } else {
- TypeDeclaration type = (TypeDeclaration)foundMethod;
- if (type.fields != null) {
- for (int i = 0; i < type.fields.length; i++) {
- FieldDeclaration field = type.fields[i];
- if (field instanceof Initializer && field.sourceStart <= selectionStart && selectionStart <= field.sourceEnd) {
- parser.parseBlockStatements((Initializer)field, type, unit);
- break;
- }
- }
- }
- }
- }
- String computedUnitToString = unit.toString();
- //System.out.println(computedUnitToString);
- //System.out.println(expectedUnitToString);
-
- String computedCompletion = parser.assistNode == null
- ? NONE
- : parser.assistNode.toString();
- assertEquals(
- "invalid selection node-" + testName,
- expectedSelection,
- computedCompletion);
-
- if (!expectedUnitToString.equals(computedUnitToString)) {
- System.out.println(Util.displayString(computedUnitToString, 2));
- }
- assertEquals(
- "invalid selection unit-"+testName,
- expectedUnitToString,
- computedUnitToString);
-
- if (expectedSelectionIdentifier != null){
- char[] chars = ((SelectionScanner)parser.scanner).selectionIdentifier;
- String computedSelectionIdentifier = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid selection identifier-" + testName,
- expectedSelectionIdentifier,
- computedSelectionIdentifier);
- }
- if (expectedSelectedSource != null){
- char[] chars = null;
- if (parser.assistNode != null){
- chars = CharOperation.subarray(
- parser.scanner.source,
- parser.assistNode.sourceStart,
- parser.assistNode.sourceEnd + 1);
- } else {
- if (parser.assistIdentifier() != null){
- if (((SelectionScanner)parser.scanner).selectionEnd
- >= ((SelectionScanner)parser.scanner).selectionStart){
- chars = CharOperation.subarray(
- parser.scanner.source,
- ((SelectionScanner)parser.scanner).selectionStart,
- ((SelectionScanner)parser.scanner).selectionEnd + 1);
- }
- }
- }
- String computedReplacedSource = chars == null ? NONE : new String(chars);
- assertEquals(
- "invalid replaced source-" + testName,
- expectedSelectedSource,
- computedReplacedSource);
- }
- if (expectedLabels != null) {
-/*
- assert("no labels-" + testName, parser.labels != null);
- int length = parser.labels.length;
- assertEquals("invalid number of labels-" + testName, expectedLabels.length, length);
- for (int i = 0; i < length; i++) {
- String label = new String(parser.labels[i]);
- assertEquals("invalid label-" + testName, expectedLabels[i], label);
- }
-*/
- }
-}
-/*
- * Parse a method with selectionNode check
- */
-public void checkMethodParse(
- char[] source,
- int selectionStart,
- int selectionEnd,
- String expectedSelection,
- String expectedUnitToString,
- String expectedSelectionIdentifier,
- String expectedSelectedSource,
- String testName) {
-
- this.checkMethodParse(
- source,
- selectionStart,
- selectionEnd,
- expectedSelection,
- expectedUnitToString,
- expectedSelectionIdentifier,
- expectedSelectedSource,
- null,
- testName);
-}
-/*
- * Returns the method, the constructor or the type declaring the initializer
- * at the cursor location in the given type.
- * Returns null if not found.
- */
-protected ASTNode findMethod(TypeDeclaration type, int cursorLocation) {
- if (type.methods != null) {
- for (int i = 0; i < type.methods.length; i++) {
- AbstractMethodDeclaration method = type.methods[i];
- if (method.declarationSourceStart <= cursorLocation && (cursorLocation <= method.declarationSourceEnd || method.declarationSourceEnd == 0)) {
- return method;
- }
- }
- }
- if (type.memberTypes != null) {
- for (int i = 0; i < type.memberTypes.length; i++) {
- TypeDeclaration memberType = type.memberTypes[i];
- ASTNode method = findMethod(memberType, cursorLocation);
- if (method != null) {
- return method;
- }
- }
- }
- if (type.fields != null) {
- for (int i = 0; i < type.fields.length; i++) {
- FieldDeclaration field = type.fields[i];
- if (field instanceof Initializer) {
- Initializer initializer = (Initializer)field;
- Block block = initializer.block;
- if (block != null && block.sourceStart <= cursorLocation && (cursorLocation <= block.sourceEnd || block.sourceEnd == 0)) {
- return type;
- }
- }
- }
- }
- return null;
-}
-/**
- * Runs the given test that checks that method completion parsing returns the given completion.
- */
-protected void runTestCheckMethodParse(
- String compilationUnit,
- String selectionStartBehind,
- String selectionEndBehind,
- String expectedSelectionNodeToString,
- String expectedUnitDisplayString,
- String expectedSelectionIdentifier,
- String expectedReplacedSource,
- String testName) {
-
- int selectionStartBehindStart = compilationUnit.indexOf(selectionStartBehind);
- assertTrue("selectionStartBehind string not found", selectionStartBehindStart != -1);
- int selectionStart = selectionStartBehindStart + selectionStartBehind.length();
- int selectionEndBehindStart = compilationUnit.indexOf(selectionEndBehind);
- assertTrue("selectionEndBehind string not found", selectionEndBehindStart != -1);
- int selectionEnd = selectionEndBehindStart + selectionEndBehind.length() - 1;
-
- this.checkMethodParse(
- compilationUnit.toCharArray(),
- selectionStart,
- selectionEnd,
- expectedSelectionNodeToString,
- expectedUnitDisplayString,
- expectedSelectionIdentifier,
- expectedReplacedSource,
- testName);
-}
-}
View
194 ...c/org/eclipse/wst/jsdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java
@@ -1,194 +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.compiler.parser;
-
-import junit.framework.Test;
-
-/**
- * Completion is expected to be an AllocationExpression.
- */
-public class AllocationExpressionCompletionTest extends AbstractCompletionTest {
-public AllocationExpressionCompletionTest(String testName) {
- super(testName);
-}
-public static Test suite() {
- return buildAllCompliancesTestSuite(AllocationExpressionCompletionTest.class);
-}
-/*
- * Completion inside an if statement.
- */
-public void testInIfStatement() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " if (true) { \n" +
- " new z.y.X(1, 2, i); \n" +
- " } \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnAllocationExpression:new z.y.X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " {\n" +
- " <CompleteOnAllocationExpression:new z.y.X(1, 2)>;\n" +
- " }\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete inside an if statement>"
- );
-}
-/*
- * Completion on a constructor invocation with no qualification and using a qualified type name.
- *
- * ie. ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
- * where ClassType is a qualified type name
- */
-public void testNoQualificationQualifiedTypeName() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new z.y.X(1, 2, i); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnAllocationExpression:new z.y.X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnAllocationExpression:new z.y.X(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on non qualified instance creation with qualified type name>"
- );
-}
-/*
- * Completion on a constructor invocation with no qualification and using a simple type name.
- *
- * ie. ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
- * where ClassType is a simple type name
- */
-public void testNoQualificationSimpleTypeName() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " new X(1, 2, i); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnAllocationExpression:new X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnAllocationExpression:new X(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on non qualified instance creation with simple type name>"
- );
-}
-/*
- * Completion on a constructor invocation qualified with a name.
- *
- * ie. ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testQualifiedWithName() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar {\n" +
- " void foo() { \n" +
- " Buz.x.new X(1, 2, i); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnQualifiedAllocationExpression:Buz.x.new X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnQualifiedAllocationExpression:Buz.x.new X(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on name qualified instance creation>"
- );
-}
-/*
- * Completion on a constructor invocation qualified with a primary.
- *
- * ie. ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- */
-public void testQualifiedWithPrimary() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " primary().new X(1, 2, i); \n" +
- " } \n" +
- "}\n",
- // completeBehind:
- "X(1, 2,",
- // expectedCompletionNodeToString:
- "<CompleteOnQualifiedAllocationExpression:primary().new X(1, 2)>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnQualifiedAllocationExpression:primary().new X(1, 2)>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on primary qualified instance creation>"
- );
-}
-}
View
214 ...src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java
@@ -1,214 +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.compiler.parser;
-
-import junit.framework.Test;
-
-/**
- * Completion is expected to be a ClassLiteralAccess.
- */
-public class ClassLiteralAccessCompletionTest extends AbstractCompletionTest {
-public ClassLiteralAccessCompletionTest(String testName) {
- super(testName);
-}
-public static Test suite() {
- return buildAllCompliancesTestSuite(ClassLiteralAccessCompletionTest.class);
-}
-/*
- * Completion on the keyword 'class' on an array type
- */
-public void testArrayType() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " String[].; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "String[].",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:String[].>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:String[].>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "String[].",
- // test name
- "<complete on array type member>"
- );
-}
-/*
- * Test access to the keyword 'class' on an array type
- * where the keyword is non empty.
- */
-public void testArrayTypeWithNonEmptyIdentifier() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " String[].class; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "String[].cl",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:String[].cl>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:String[].cl>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "cl",
- // expectedReplacedSource:
- "String[].class",
- // test name
- "<complete on array type member with non empty identifier>"
- );
-}
-/*
- * Completion on the keyword 'class' on a primitive array type
- */
-public void testPrimitiveArrayType() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int[].; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int[].",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:int[].>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:int[].>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "int[].",
- // test name
- "<complete on primitive array type member>"
- );
-}
-/*
- * Completion on the keyword 'class' on a primitive array type where the
- * keyword is non empty
- */
-public void testPrimitiveArrayTypeWithNonEmptyIdentifier() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int[].class; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int[].cl",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:int[].cl>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:int[].cl>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "cl",
- // expectedReplacedSource:
- "int[].class",
- // test name
- "<complete on primitive array type member with non empty identifier>"
- );
-}
-/*
- * Completion on the keyword 'class' on a primitive type
- */
-public void testPrimitiveType() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int.; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int.",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:int.>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:int.>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "int.",
- // test name
- "<complete on primitive type member>"
- );
-}
-/*
- * Completion on the keyword 'class' on a primitive type where the
- * keyword is non empty
- */
-public void testPrimitiveTypeWithNonEmptyIdentifier() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class Bar { \n" +
- " void foo() { \n" +
- " int.class; \n" +
- " } \n" +
- "} \n",
- // completeBehind:
- "int.cl",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:int.cl>",
- // expectedUnitDisplayString:
- "class Bar {\n" +
- " Bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " <CompleteOnClassLiteralAccess:int.cl>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "cl",
- // expectedReplacedSource:
- "int.class",
- // test name
- "<complete on primitive type member with non empty identifier>"
- );
-}
-}
View
8,713 ...ts.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest.java
0 additions, 8,713 deletions not shown
View
9,671 ...s.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest2.java
0 additions, 9,671 deletions not shown
View
15,538 ...iler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTestKeyword.java
0 additions, 15,538 deletions not shown
View
1,031 ....compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionRecoveryTest.java
@@ -1,1031 +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.compiler.parser;
-
-import junit.framework.Test;
-
-public class CompletionRecoveryTest extends AbstractCompletionTest {
-public CompletionRecoveryTest(String testName){
- super(testName);
-}
-static {
-// TESTS_NUMBERS = new int[] { 22 };
-}
-public static Test suite() {
- return buildAllCompliancesTestSuite(CompletionRecoveryTest.class);
-}
-/*
- * Complete on variable behind ill-formed declaration
- */
-public void test01() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException { \n" +
- " int foo(){ \n" +
- " String str = ; \n" +
- " str. \n";
-
- String completeBehind = "str.";
- String expectedCompletionNodeToString = "<CompleteOnName:str.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " String str;\n" +
- " <CompleteOnName:str.>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "str.";
- String testName = "<complete on variable behind ill-formed declaration>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable behind ill-formed declaration and nested block
- */
-public void test02() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException { \n" +
- " int foo(){ \n" +
- " String str = ; \n" +
- " { \n" +
- " int i; \n" +
- " str. \n";
-
- String completeBehind = "str.";
- String expectedCompletionNodeToString = "<CompleteOnName:str.>";
- String completionIdentifier = "";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " String str;\n" +
- " {\n" +
- " int i;\n" +
- " <CompleteOnName:str.>;\n" +
- " }\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "str.";
- String testName = "<complete on variable behind ill-formed declaration and nested block>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable behind ill-formed declaration and inside local type field initialization
- */
-public void test03() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends IOException { \n" +
- " int foo(){ \n" +
- " final String str = ; \n" +
- " class L { \n" +
- " int i = str \n";
-
- String completeBehind = "i = str";
- String expectedCompletionNodeToString = "<CompleteOnName:str>";
- String completionIdentifier = "str";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " final String str;\n" +
- " class L {\n" +
- " int i = <CompleteOnName:str>;\n" +
- " L() {\n" +
- " super();\n" + // could be optimized out
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "str";
- String testName = "<complete on variable behind ill-formed declaration and inside local type field initialization>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable behind closed scope
- */
-public void test04() {
-
- String str =
- "import java.io.*; \n" +
- " \n" +
- "public class X extends \n" +
- " int foo(String str) \n" +
- " String variable = ; \n" +
- " { \n" +
- " String variableNotInScope; \n" +
- " } \n" +
- " foo(varia \n";
-
- String completeBehind = "foo(var";
- String expectedCompletionNodeToString = "<CompleteOnName:var>";
- String completionIdentifier = "var";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo(String str) {\n" +
- " String variable;\n" +
- " foo(<CompleteOnName:var>);\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "varia";
- String testName = "<complete on variable behind closed scope>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable str with sibling method stringAppend()
- */
-public void test05() {
-
- String str =
- "import java.io.*; \n"+
- " \n"+
- "public class X extends \n"+
- " int foo(String str) \n"+
- " String str = ; \n"+
- " { \n"+
- " String strNotInScope; \n"+
- " } \n"+
- " class L { \n"+
- " int bar(){ \n"+
- " foo(str \n"+
- " void stringAppend(String s1, String s2) \n";
-
- String completeBehind = "foo(str";
- String expectedCompletionNodeToString = "<CompleteOnName:str>";
- String completionIdentifier = "str";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo(String str) {\n" +
- " String str;\n" +
- " class L {\n" +
- " L() {\n" +
- " }\n" +
- " int bar() {\n" +
- " foo(<CompleteOnName:str>);\n" +
- " }\n" +
- " void stringAppend(String s1, String s2) {\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "str";
- String testName = "<complete on variable str with sibling method stringAppend()>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on variable str with sibling method stringAppend(), eliminating
- * uninteresting method bodies
- */
-public void test06() {
-
- String str =
- "import java.io.*; \n"+
- " \n"+
- "public class X extends \n"+
- " int foo(String str) \n"+
- " String str = ; \n"+
- " { \n"+
- " String strNotInScope; \n"+
- " } \n"+
- " class L { \n"+
- " int notInterestingBody(){ \n"+
- " System.out.println(); \n"+
- " } \n"+
- " int bar(){ \n"+
- " foo(str \n"+
- " void stringAppend(String s1, String s2) \n";
-
- String completeBehind = "foo(str";
- String expectedCompletionNodeToString = "<CompleteOnName:str>";
- String completionIdentifier = "str";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo(String str) {\n" +
- " String str;\n" +
- " class L {\n" +
- " L() {\n" +
- " }\n" +
- " int notInterestingBody() {\n" +
- " }\n" +
- " int bar() {\n" +
- " foo(<CompleteOnName:str>);\n" +
- " }\n" +
- " void stringAppend(String s1, String s2) {\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n";
-
- String expectedReplacedSource = "str";
- String testName = "<complete on variable eliminating other uninteresting method bodies>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on new keyword
- */
-public void test07(){
-
- String str =
- "import java.io.* \n" +
- " \n" +
- "public class X extends IOException { \n" +
- " int foo() { \n" +
- " X x = new X( \n" +
- "} \n";
-
- String completeBehind = "= n";
- String expectedCompletionNodeToString = "<CompleteOnName:n>";
- String completionIdentifier = "n";
- String expectedUnitDisplayString =
- "import java.io.*;\n" +
- "public class X extends IOException {\n" +
- " public X() {\n" +
- " }\n" +
- " int foo() {\n" +
- " X x = <CompleteOnName:n>;\n" +
- " }\n" +
- "}\n";
- String expectedReplacedSource = "new";
- String testName = "<complete on new keyword>";
-
- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
- this.checkMethodParse(
- str.toCharArray(),
- cursorLocation,
- expectedCompletionNodeToString,
- expectedUnitDisplayString,
- completionIdentifier,
- expectedReplacedSource,
- testName);
-}
-/*
- * Complete on field type in anonymous type.
- */
-public void test08() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "package test;\n" +
- "import java.util.Vector;\n" +
- "public class VA {\n" +
- " Object o1 = new Object() {\n" +
- " V\n" +
- " void foo2() {\n" +
- " int i = 1;\n" +
- " }\n" +
- " };\n" +
- " String s2;\n" +
- " void bar() {\n" +
- " }\n" +
- " void foo() { \n" +
- " new String[] {}..equals()\n" +
- " }\n" +
- "}\n",
- // completeBehind:
- " V",
- // expectedCompletionNodeToString:
- "<CompleteOnType:V>",
- // expectedUnitDisplayString:
- "package test;\n" +
- "import java.util.Vector;\n" +
- "public class VA {\n" +
- " Object o1 = new Object() {\n" +
- " <CompleteOnType:V>;\n" +
- " void foo2() {\n" +
- " }\n" +
- " };\n" +
- " String s2;\n" +
- " public VA() {\n" +
- " }\n" +
- " void bar() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "V",
- // expectedReplacedSource:
- "V",
- // test name
- "<completion on field type in anonymous type>"
- );
-}
-/*
- * Complete on argument name
- */
-public void test09() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "package pack; \n"+
- "class A { \n"+
- " \n"+
- " public static void main(String[] argv \n"+
- " new Member().f \n"+
- " ; \n"+
- " } \n"+
- " class Member { \n"+
- " int foo() \n"+
- " } \n"+
- " } \n"+
- "}; \n",
- // completeBehind:
- "argv",
- // expectedCompletionNodeToString:
- "<CompleteOnArgumentName:String[] argv>",
- // expectedUnitDisplayString:
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- " public static void main(<CompleteOnArgumentName:String[] argv>) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "argv",
- // expectedReplacedSource:
- "argv",
- // test name
- "<completion on argument name>"
- );
-}
-/*
- * Complete on argument name
- */
-public void test10() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "package pack; \n"+
- "class A { \n"+
- " \n"+
- " public static void main(String[] argv \n"+
- " new Member().f \n"+
- " ; \n"+
- " } \n"+
- " class Member { \n"+
- " int foo() \n"+
- " } \n"+
- " } \n"+
- "}; \n",
- // completeBehind:
- "argv",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- " public static void main(<CompleteOnArgumentName:String[] argv>) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<completion on argument name>"
- );
-}
-/*
- * Complete inside method with incomplete signature
- */
-public void test11() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "package pack; \n"+
- "class A { \n"+
- " \n"+
- " public static void main(String[] argv \n"+
- " new Member().f \n"+
- " ; \n"+
- " } \n"+
- " class Member { \n"+
- " int foo() \n"+
- " } \n"+
- " } \n"+
- "}; \n",
- // completeBehind:
- "new Member().f",
- // expectedCompletionNodeToString:
- "<CompleteOnMemberAccess:new Member().f>",
- // expectedUnitDisplayString:
- "package pack;\n" +
- "class A {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " int foo() {\n" +
- " }\n" +
- " }\n" +
- " A() {\n" +
- " }\n" +
- " public static void main(String[] argv) {\n" +
- " <CompleteOnMemberAccess:new Member().f>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "f",
- // expectedReplacedSource:
- "f",
- // test name
- "<complete inside method with incomplete signature>"
- );
-}
-/*
- * Complete on argument name with class decl later on
- */
-public void test12() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class DD { \n"+
- " public static void main(String[] argv \n"+
- " \n"+
- "class D { \n"+
- " \n"+
- " int i; \n"+
- " class Mem1 {} \n"+
- " int dumb(String s) \n"+
- " int dumb(float fNum, double dNum) { \n"+
- " dumb(\"world\", i); \n"+
- " \n"+
- " if (i == 0) { \n"+
- " class Local { \n"+
- " \n"+
- " int hello() \n",
- // completeBehind:
- "argv",
- // expectedCompletionNodeToString:
- "<CompleteOnName:>",
- // expectedUnitDisplayString:
- "class DD {\n" +
- " DD() {\n" +
- " }\n" +
- " public static void main(<CompleteOnArgumentName:String[] argv>) {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "",
- // test name
- "<complete on argument name with class decl later on>"
- );
-}
-/*
- * Complete behind array type
- */
-public void test13() {
- this.runTestCheckMethodParse(
- // compilationUnit:
- "class C { \n"+
- " void test() { \n"+
- " String[]. \n"+
- " } \n"+
- "} \n",
- // completeBehind:
- "String[].",
- // expectedCompletionNodeToString:
- "<CompleteOnClassLiteralAccess:String[].>",
- // expectedUnitDisplayString:
- "class C {\n" +
- " C() {\n" +
- " }\n" +
- " void test() {\n" +
- " <CompleteOnClassLiteralAccess:String[].>;\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- "String[].",
- // test name
- "<complete behind array type>"
- );
-}
-/*
- * Complete inside array type
- */
-public void test14() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "public class B { \n"+
- " class Member {} \n"+
- " \n"+
- " int[] j; \n",
- // completeBehind:
- "int[",
- // expectedCompletionNodeToString:
- NONE,
- // expectedUnitDisplayString:
- "public class B {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " }\n" +
- " public B() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- NONE,
- // test name
- "<complete inside array type>"
- );
-}
-/*
- * Complete inside array type
- */
-public void test15() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "public class B { \n"+
- " class Member {} \n"+
- " \n"+
- " int[ \n",
- // completeBehind:
- "int[",
- // expectedCompletionNodeToString:
- NONE,
- // expectedUnitDisplayString:
- "public class B {\n" +
- " class Member {\n" +
- " Member() {\n" +
- " }\n" +
- " }\n" +
- " public B() {\n" +
- " }\n" +
- "}\n",
- // expectedCompletionIdentifier:
- "",
- // expectedReplacedSource:
- NONE,
- // test name
- "<complete inside array type>"
- );
-}
-/*
- * Complete behind invalid array type
- */
-public void test16() {
- this.runTestCheckDietParse(
- // compilationUnit:
- "public class B { \n"+
- " class Member {} \n"+
- " \n"+
- " int[ \n"+
- " Obje \n",
- // completeBehind:
- "Obje",
- // expectedCompletionNodeToString:
- "<CompleteOnType:Obje>",
- // expectedUnitDisplayString: